Kernel-Tests.js 331 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042
  1. define("amber_core/Kernel-Tests", ["amber/boot", "amber_core/SUnit", "amber_core/Kernel-Objects"], function($boot){
  2. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  3. smalltalk.addPackage('Kernel-Tests');
  4. smalltalk.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  5. smalltalk.addClass('AnnouncementSubscriptionTest', globals.TestCase, [], 'Kernel-Tests');
  6. smalltalk.addMethod(
  7. smalltalk.method({
  8. selector: "testAddExtensionMethod",
  9. protocol: 'tests',
  10. fn: function (){
  11. var self=this;
  12. var method,dirty;
  13. return smalltalk.withContext(function($ctx1) {
  14. var $2,$1,$4,$3,$5,$8,$7,$6,$9,$10;
  15. $2=self._class();
  16. $ctx1.sendIdx["class"]=1;
  17. $1=_st($2)._package();
  18. $ctx1.sendIdx["package"]=1;
  19. dirty=_st($1)._isDirty();
  20. $ctx1.sendIdx["isDirty"]=1;
  21. $4=self._class();
  22. $ctx1.sendIdx["class"]=2;
  23. $3=_st($4)._package();
  24. $ctx1.sendIdx["package"]=2;
  25. _st($3)._beClean();
  26. $5=self._class();
  27. $ctx1.sendIdx["class"]=3;
  28. method=_st($5)._compile_protocol_("doNothing","**not-a-package");
  29. $8=self._class();
  30. $ctx1.sendIdx["class"]=4;
  31. $7=_st($8)._package();
  32. $ctx1.sendIdx["package"]=3;
  33. $6=_st($7)._isDirty();
  34. self._deny_($6);
  35. $9=self._class();
  36. $ctx1.sendIdx["class"]=5;
  37. _st($9)._removeCompiledMethod_(method);
  38. $10=dirty;
  39. if(smalltalk.assert($10)){
  40. _st(_st(self._class())._package())._beDirty();
  41. };
  42. return self}, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty},globals.AnnouncementSubscriptionTest)})},
  43. args: [],
  44. source: "testAddExtensionMethod\x0a\x09| method dirty |\x0a\x09dirty := self class package isDirty.\x0a\x09self class package beClean.\x0a\x09method := self class compile: 'doNothing' protocol: '**not-a-package'.\x0a\x09self deny: self class package isDirty.\x0a\x09\x0a\x09self class removeCompiledMethod: method.\x0a\x09dirty ifTrue: [ self class package beDirty ]",
  45. messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"],
  46. referencedClasses: []
  47. }),
  48. globals.AnnouncementSubscriptionTest);
  49. smalltalk.addMethod(
  50. smalltalk.method({
  51. selector: "testHandlesAnnouncement",
  52. protocol: 'tests',
  53. fn: function (){
  54. var self=this;
  55. var subscription,announcementClass1,announcementClass2,classBuilder;
  56. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  57. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  58. function $AnnouncementSubscription(){return globals.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  59. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  60. return smalltalk.withContext(function($ctx1) {
  61. var $1,$2;
  62. classBuilder=_st($ClassBuilder())._new();
  63. $ctx1.sendIdx["new"]=1;
  64. announcementClass1=_st(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($SystemAnnouncement(),"TestAnnouncement1",[],"Kernel-Tests");
  65. subscription=_st(_st($AnnouncementSubscription())._new())._announcementClass_($SystemAnnouncement());
  66. $1=_st(subscription)._handlesAnnouncement_($SystemAnnouncement());
  67. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  68. self._assert_equals_($1,true);
  69. $ctx1.sendIdx["assert:equals:"]=1;
  70. $2=_st(subscription)._handlesAnnouncement_(announcementClass1);
  71. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  72. self._assert_equals_($2,true);
  73. $ctx1.sendIdx["assert:equals:"]=2;
  74. self._assert_equals_(_st(subscription)._handlesAnnouncement_($Object()),false);
  75. _st(classBuilder)._basicRemoveClass_(announcementClass1);
  76. return self}, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},globals.AnnouncementSubscriptionTest)})},
  77. args: [],
  78. source: "testHandlesAnnouncement\x0a\x09| subscription announcementClass1 announcementClass2 classBuilder |\x0a\x09\x0a\x09classBuilder := ClassBuilder new.\x0a\x09announcementClass1 := classBuilder basicAddSubclassOf: SystemAnnouncement named: 'TestAnnouncement1' instanceVariableNames: #() package: 'Kernel-Tests'.\x0a\x09\x0a\x09subscription := AnnouncementSubscription new announcementClass: SystemAnnouncement.\x0a\x09\x22Test whether the same class triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: SystemAnnouncement) equals: true.\x0a\x09\x22Test whether a subclass triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: announcementClass1) equals: true.\x0a\x09\x22Test whether an unrelated class does not trigger the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: Object) equals: false.\x0a\x09\x0a\x09classBuilder basicRemoveClass: announcementClass1.",
  79. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"],
  80. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"]
  81. }),
  82. globals.AnnouncementSubscriptionTest);
  83. smalltalk.addClass('AnnouncerTest', globals.TestCase, [], 'Kernel-Tests');
  84. smalltalk.addMethod(
  85. smalltalk.method({
  86. selector: "testOnDo",
  87. protocol: 'tests',
  88. fn: function (){
  89. var self=this;
  90. var counter,announcer;
  91. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  92. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  93. return smalltalk.withContext(function($ctx1) {
  94. var $1,$2;
  95. counter=(0);
  96. announcer=_st($Announcer())._new();
  97. $ctx1.sendIdx["new"]=1;
  98. _st(announcer)._on_do_($SystemAnnouncement(),(function(){
  99. return smalltalk.withContext(function($ctx2) {
  100. counter=_st(counter).__plus((1));
  101. return counter;
  102. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  103. $1=announcer;
  104. $2=_st($SystemAnnouncement())._new();
  105. $ctx1.sendIdx["new"]=2;
  106. _st($1)._announce_($2);
  107. $ctx1.sendIdx["announce:"]=1;
  108. self._assert_equals_(counter,(1));
  109. $ctx1.sendIdx["assert:equals:"]=1;
  110. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  111. self._assert_equals_(counter,(2));
  112. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},globals.AnnouncerTest)})},
  113. args: [],
  114. source: "testOnDo\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement do: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.",
  115. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"],
  116. referencedClasses: ["Announcer", "SystemAnnouncement"]
  117. }),
  118. globals.AnnouncerTest);
  119. smalltalk.addMethod(
  120. smalltalk.method({
  121. selector: "testOnDoFor",
  122. protocol: 'tests',
  123. fn: function (){
  124. var self=this;
  125. var counter,announcer;
  126. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  127. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  128. return smalltalk.withContext(function($ctx1) {
  129. var $1,$2,$3,$4;
  130. counter=(0);
  131. announcer=_st($Announcer())._new();
  132. $ctx1.sendIdx["new"]=1;
  133. _st(announcer)._on_do_for_($SystemAnnouncement(),(function(){
  134. return smalltalk.withContext(function($ctx2) {
  135. counter=_st(counter).__plus((1));
  136. return counter;
  137. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),self);
  138. $1=announcer;
  139. $2=_st($SystemAnnouncement())._new();
  140. $ctx1.sendIdx["new"]=2;
  141. _st($1)._announce_($2);
  142. $ctx1.sendIdx["announce:"]=1;
  143. self._assert_equals_(counter,(1));
  144. $ctx1.sendIdx["assert:equals:"]=1;
  145. $3=announcer;
  146. $4=_st($SystemAnnouncement())._new();
  147. $ctx1.sendIdx["new"]=3;
  148. _st($3)._announce_($4);
  149. $ctx1.sendIdx["announce:"]=2;
  150. self._assert_equals_(counter,(2));
  151. $ctx1.sendIdx["assert:equals:"]=2;
  152. _st(announcer)._unsubscribe_(self);
  153. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  154. self._assert_equals_(counter,(2));
  155. return self}, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},globals.AnnouncerTest)})},
  156. args: [],
  157. source: "testOnDoFor\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement do: [ counter := counter + 1 ] for: self.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.\x0a\x09\x0a\x09announcer unsubscribe: self.\x0a\x09\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.",
  158. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"],
  159. referencedClasses: ["Announcer", "SystemAnnouncement"]
  160. }),
  161. globals.AnnouncerTest);
  162. smalltalk.addMethod(
  163. smalltalk.method({
  164. selector: "testOnDoOnce",
  165. protocol: 'tests',
  166. fn: function (){
  167. var self=this;
  168. var counter,announcer;
  169. function $Announcer(){return globals.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  170. function $SystemAnnouncement(){return globals.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  171. return smalltalk.withContext(function($ctx1) {
  172. var $1,$2;
  173. counter=(0);
  174. announcer=_st($Announcer())._new();
  175. $ctx1.sendIdx["new"]=1;
  176. _st(announcer)._on_doOnce_($SystemAnnouncement(),(function(){
  177. return smalltalk.withContext(function($ctx2) {
  178. counter=_st(counter).__plus((1));
  179. return counter;
  180. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  181. $1=announcer;
  182. $2=_st($SystemAnnouncement())._new();
  183. $ctx1.sendIdx["new"]=2;
  184. _st($1)._announce_($2);
  185. $ctx1.sendIdx["announce:"]=1;
  186. self._assert_equals_(counter,(1));
  187. $ctx1.sendIdx["assert:equals:"]=1;
  188. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  189. self._assert_equals_(counter,(1));
  190. return self}, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},globals.AnnouncerTest)})},
  191. args: [],
  192. source: "testOnDoOnce\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement doOnce: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.",
  193. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"],
  194. referencedClasses: ["Announcer", "SystemAnnouncement"]
  195. }),
  196. globals.AnnouncerTest);
  197. smalltalk.addClass('BlockClosureTest', globals.TestCase, [], 'Kernel-Tests');
  198. smalltalk.addMethod(
  199. smalltalk.method({
  200. selector: "testCanClearInterval",
  201. protocol: 'tests',
  202. fn: function (){
  203. var self=this;
  204. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  205. return smalltalk.withContext(function($ctx1) {
  206. self._shouldnt_raise_((function(){
  207. return smalltalk.withContext(function($ctx2) {
  208. return _st(_st((function(){
  209. return smalltalk.withContext(function($ctx3) {
  210. return _st(_st($Error())._new())._signal();
  211. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithInterval_((0)))._clearInterval();
  212. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  213. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},globals.BlockClosureTest)})},
  214. args: [],
  215. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  216. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"],
  217. referencedClasses: ["Error"]
  218. }),
  219. globals.BlockClosureTest);
  220. smalltalk.addMethod(
  221. smalltalk.method({
  222. selector: "testCanClearTimeout",
  223. protocol: 'tests',
  224. fn: function (){
  225. var self=this;
  226. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  227. return smalltalk.withContext(function($ctx1) {
  228. self._shouldnt_raise_((function(){
  229. return smalltalk.withContext(function($ctx2) {
  230. return _st(_st((function(){
  231. return smalltalk.withContext(function($ctx3) {
  232. return _st(_st($Error())._new())._signal();
  233. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithTimeout_((0)))._clearTimeout();
  234. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  235. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},globals.BlockClosureTest)})},
  236. args: [],
  237. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  238. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"],
  239. referencedClasses: ["Error"]
  240. }),
  241. globals.BlockClosureTest);
  242. smalltalk.addMethod(
  243. smalltalk.method({
  244. selector: "testCompiledSource",
  245. protocol: 'tests',
  246. fn: function (){
  247. var self=this;
  248. return smalltalk.withContext(function($ctx1) {
  249. self._assert_(_st(_st((function(){
  250. return smalltalk.withContext(function($ctx2) {
  251. return (1).__plus((1));
  252. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._compiledSource())._includesSubString_("function"));
  253. return self}, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},globals.BlockClosureTest)})},
  254. args: [],
  255. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  256. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"],
  257. referencedClasses: []
  258. }),
  259. globals.BlockClosureTest);
  260. smalltalk.addMethod(
  261. smalltalk.method({
  262. selector: "testCurrySelf",
  263. protocol: 'tests',
  264. fn: function (){
  265. var self=this;
  266. var curriedMethod,array;
  267. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  268. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  269. return smalltalk.withContext(function($ctx1) {
  270. curriedMethod=_st(_st((function(selfarg,x){
  271. return smalltalk.withContext(function($ctx2) {
  272. return _st(selfarg)._at_(x);
  273. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)})}))._currySelf())._asCompiledMethod_("foo:");
  274. array=[(3), (1), (4)];
  275. _st(_st($ClassBuilder())._new())._installMethod_forClass_protocol_(curriedMethod,$Array(),"**test helper");
  276. _st((function(){
  277. return smalltalk.withContext(function($ctx2) {
  278. return self._assert_equals_(_st(array)._foo_((2)),(1));
  279. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))._ensure_((function(){
  280. return smalltalk.withContext(function($ctx2) {
  281. return _st($Array())._removeCompiledMethod_(curriedMethod);
  282. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  283. return self}, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},globals.BlockClosureTest)})},
  284. args: [],
  285. source: "testCurrySelf\x0a\x09| curriedMethod array |\x0a\x09curriedMethod := [ :selfarg :x | selfarg at: x ] currySelf asCompiledMethod: 'foo:'.\x0a\x09array := #(3 1 4).\x0a\x09ClassBuilder new installMethod: curriedMethod forClass: Array protocol: '**test helper'.\x0a\x09[ self assert: (array foo: 2) equals: 1 ]\x0a\x09ensure: [ Array removeCompiledMethod: curriedMethod ]",
  286. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"],
  287. referencedClasses: ["ClassBuilder", "Array"]
  288. }),
  289. globals.BlockClosureTest);
  290. smalltalk.addMethod(
  291. smalltalk.method({
  292. selector: "testEnsure",
  293. protocol: 'tests',
  294. fn: function (){
  295. var self=this;
  296. return smalltalk.withContext(function($ctx1) {
  297. self._assert_equals_(_st((function(){
  298. return (3);
  299. }))._ensure_((function(){
  300. return (4);
  301. })),(3));
  302. return self}, function($ctx1) {$ctx1.fill(self,"testEnsure",{},globals.BlockClosureTest)})},
  303. args: [],
  304. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  305. messageSends: ["assert:equals:", "ensure:"],
  306. referencedClasses: []
  307. }),
  308. globals.BlockClosureTest);
  309. smalltalk.addMethod(
  310. smalltalk.method({
  311. selector: "testEnsureRaises",
  312. protocol: 'tests',
  313. fn: function (){
  314. var self=this;
  315. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  316. return smalltalk.withContext(function($ctx1) {
  317. self._should_raise_((function(){
  318. return smalltalk.withContext(function($ctx2) {
  319. return _st((function(){
  320. return smalltalk.withContext(function($ctx3) {
  321. return _st(_st($Error())._new())._signal();
  322. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._ensure_((function(){
  323. return true;
  324. }));
  325. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  326. return self}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},globals.BlockClosureTest)})},
  327. args: [],
  328. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  329. messageSends: ["should:raise:", "ensure:", "signal", "new"],
  330. referencedClasses: ["Error"]
  331. }),
  332. globals.BlockClosureTest);
  333. smalltalk.addMethod(
  334. smalltalk.method({
  335. selector: "testExceptionSemantics",
  336. protocol: 'tests',
  337. fn: function (){
  338. var self=this;
  339. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  340. return smalltalk.withContext(function($ctx1) {
  341. self._timeout_((100));
  342. _st(self._async_((function(){
  343. return smalltalk.withContext(function($ctx2) {
  344. return _st((function(){
  345. return smalltalk.withContext(function($ctx3) {
  346. self._assert_(true);
  347. _st($Error())._signal();
  348. self._deny_(true);
  349. return self._finished();
  350. $ctx3.sendIdx["finished"]=1;
  351. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._on_do_($Error(),(function(ex){
  352. return smalltalk.withContext(function($ctx3) {
  353. return self._finished();
  354. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)})}));
  355. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._valueWithTimeout_((0));
  356. return self}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},globals.BlockClosureTest)})},
  357. args: [],
  358. source: "testExceptionSemantics\x0a\x09\x22See https://github.com/NicolasPetton/amber/issues/314\x22\x0a\x09self timeout: 100.\x0a\x09\x0a\x09(self async: [\x0a\x09\x09[\x0a\x09\x09\x09self assert: true.\x0a\x09\x09\x09Error signal.\x0a\x09\x09\x09\x22The following should *not* be run\x22\x0a\x09\x09\x09self deny: true.\x0a\x09\x09\x09self finished.\x0a\x09\x09] on: Error do: [ :ex | self finished ]\x0a\x09]) valueWithTimeout: 0",
  359. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"],
  360. referencedClasses: ["Error"]
  361. }),
  362. globals.BlockClosureTest);
  363. smalltalk.addMethod(
  364. smalltalk.method({
  365. selector: "testNewWithValues",
  366. protocol: 'tests',
  367. fn: function (){
  368. var self=this;
  369. return smalltalk.withContext(function($ctx1) {
  370. function TestConstructor(arg1, arg2, arg3) {}
  371. TestConstructor.prototype.name = 'theTestPrototype';
  372. var wrappedConstructor = _st(TestConstructor);
  373. var result = wrappedConstructor._newWithValues_([1, 2, 3 ]);
  374. self._assert_(result instanceof TestConstructor);
  375. self._assert_equals_(result.name, 'theTestPrototype');
  376. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  377. self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, globals.Error);;
  378. return self}, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},globals.BlockClosureTest)})},
  379. args: [],
  380. source: "testNewWithValues\x0a<\x0a\x09function TestConstructor(arg1, arg2, arg3) {}\x0a\x09TestConstructor.prototype.name = 'theTestPrototype';\x0a\x0a\x09var wrappedConstructor = _st(TestConstructor);\x0a\x09var result = wrappedConstructor._newWithValues_([1, 2, 3 ]);\x0a\x09self._assert_(result instanceof TestConstructor);\x0a\x09self._assert_equals_(result.name, 'theTestPrototype');\x0a\x0a\x09\x22newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made.\x22\x0a\x09self._should_raise_(function () {wrappedConstructor._newWithValues_('single argument');}, globals.Error);\x0a>",
  381. messageSends: [],
  382. referencedClasses: []
  383. }),
  384. globals.BlockClosureTest);
  385. smalltalk.addMethod(
  386. smalltalk.method({
  387. selector: "testNumArgs",
  388. protocol: 'tests',
  389. fn: function (){
  390. var self=this;
  391. return smalltalk.withContext(function($ctx1) {
  392. var $1;
  393. $1=_st((function(){
  394. }))._numArgs();
  395. $ctx1.sendIdx["numArgs"]=1;
  396. self._assert_equals_($1,(0));
  397. $ctx1.sendIdx["assert:equals:"]=1;
  398. self._assert_equals_(_st((function(a,b){
  399. }))._numArgs(),(2));
  400. return self}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},globals.BlockClosureTest)})},
  401. args: [],
  402. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  403. messageSends: ["assert:equals:", "numArgs"],
  404. referencedClasses: []
  405. }),
  406. globals.BlockClosureTest);
  407. smalltalk.addMethod(
  408. smalltalk.method({
  409. selector: "testOnDo",
  410. protocol: 'tests',
  411. fn: function (){
  412. var self=this;
  413. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  414. return smalltalk.withContext(function($ctx1) {
  415. self._assert_(_st((function(){
  416. return smalltalk.withContext(function($ctx2) {
  417. return _st(_st($Error())._new())._signal();
  418. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
  419. return true;
  420. })));
  421. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{},globals.BlockClosureTest)})},
  422. args: [],
  423. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  424. messageSends: ["assert:", "on:do:", "signal", "new"],
  425. referencedClasses: ["Error"]
  426. }),
  427. globals.BlockClosureTest);
  428. smalltalk.addMethod(
  429. smalltalk.method({
  430. selector: "testValue",
  431. protocol: 'tests',
  432. fn: function (){
  433. var self=this;
  434. return smalltalk.withContext(function($ctx1) {
  435. var $1;
  436. $1=_st((function(){
  437. return smalltalk.withContext(function($ctx2) {
  438. return (1).__plus((1));
  439. $ctx2.sendIdx["+"]=1;
  440. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._value();
  441. $ctx1.sendIdx["value"]=1;
  442. self._assert_equals_($1,(2));
  443. $ctx1.sendIdx["assert:equals:"]=1;
  444. self._assert_equals_(_st((function(x){
  445. return smalltalk.withContext(function($ctx2) {
  446. return _st(x).__plus((1));
  447. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}))._value_((2)),(3));
  448. $ctx1.sendIdx["assert:equals:"]=2;
  449. self._assert_equals_(_st((function(x,y){
  450. return smalltalk.withContext(function($ctx2) {
  451. return _st(x).__star(y);
  452. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)})}))._value_value_((2),(4)),(8));
  453. $ctx1.sendIdx["assert:equals:"]=3;
  454. self._assert_equals_(_st((function(a,b,c){
  455. return (1);
  456. }))._value(),(1));
  457. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},globals.BlockClosureTest)})},
  458. args: [],
  459. source: "testValue\x0a\x09self assert: ([ 1+1 ] value) equals: 2.\x0a\x09self assert: ([ :x | x +1 ] value: 2) equals: 3.\x0a\x09self assert: ([ :x :y | x*y ] value: 2 value: 4) equals: 8.\x0a\x0a\x09\x22Arguments are optional in Amber. This isn't ANSI compliant.\x22\x0a\x0a\x09self assert: ([ :a :b :c | 1 ] value) equals: 1",
  460. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"],
  461. referencedClasses: []
  462. }),
  463. globals.BlockClosureTest);
  464. smalltalk.addMethod(
  465. smalltalk.method({
  466. selector: "testValueWithPossibleArguments",
  467. protocol: 'tests',
  468. fn: function (){
  469. var self=this;
  470. return smalltalk.withContext(function($ctx1) {
  471. var $1,$2;
  472. $1=_st((function(){
  473. return (1);
  474. }))._valueWithPossibleArguments_([(3), (4)]);
  475. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  476. self._assert_equals_($1,(1));
  477. $ctx1.sendIdx["assert:equals:"]=1;
  478. $2=_st((function(a){
  479. return smalltalk.withContext(function($ctx2) {
  480. return _st(a).__plus((4));
  481. $ctx2.sendIdx["+"]=1;
  482. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}))._valueWithPossibleArguments_([(3), (4)]);
  483. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  484. self._assert_equals_($2,(7));
  485. $ctx1.sendIdx["assert:equals:"]=2;
  486. self._assert_equals_(_st((function(a,b){
  487. return smalltalk.withContext(function($ctx2) {
  488. return _st(a).__plus(b);
  489. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)})}))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  490. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},globals.BlockClosureTest)})},
  491. args: [],
  492. source: "testValueWithPossibleArguments\x0a\x09self assert: ([ 1 ] valueWithPossibleArguments: #(3 4)) equals: 1.\x0a\x09self assert: ([ :a | a + 4 ] valueWithPossibleArguments: #(3 4)) equals: 7.\x0a\x09self assert: ([ :a :b | a + b ] valueWithPossibleArguments: #(3 4 5)) equals: 7.",
  493. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"],
  494. referencedClasses: []
  495. }),
  496. globals.BlockClosureTest);
  497. smalltalk.addMethod(
  498. smalltalk.method({
  499. selector: "testWhileFalse",
  500. protocol: 'tests',
  501. fn: function (){
  502. var self=this;
  503. var i;
  504. return smalltalk.withContext(function($ctx1) {
  505. i=(0);
  506. _st((function(){
  507. return smalltalk.withContext(function($ctx2) {
  508. return _st(i).__gt((5));
  509. $ctx2.sendIdx[">"]=1;
  510. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  511. return smalltalk.withContext(function($ctx2) {
  512. i=_st(i).__plus((1));
  513. $ctx2.sendIdx["+"]=1;
  514. return i;
  515. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  516. self._assert_equals_(i,(6));
  517. $ctx1.sendIdx["assert:equals:"]=1;
  518. i=(0);
  519. _st((function(){
  520. return smalltalk.withContext(function($ctx2) {
  521. i=_st(i).__plus((1));
  522. i;
  523. return _st(i).__gt((5));
  524. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileFalse();
  525. self._assert_equals_(i,(6));
  526. return self}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},globals.BlockClosureTest)})},
  527. args: [],
  528. source: "testWhileFalse\x0a\x09| i |\x0a\x09i := 0.\x0a\x09[ i > 5 ] whileFalse: [ i := i + 1 ].\x0a\x09self assert: i equals: 6.\x0a\x0a\x09i := 0.\x0a\x09[ i := i + 1. i > 5 ] whileFalse.\x0a\x09self assert: i equals: 6",
  529. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"],
  530. referencedClasses: []
  531. }),
  532. globals.BlockClosureTest);
  533. smalltalk.addMethod(
  534. smalltalk.method({
  535. selector: "testWhileTrue",
  536. protocol: 'tests',
  537. fn: function (){
  538. var self=this;
  539. var i;
  540. return smalltalk.withContext(function($ctx1) {
  541. i=(0);
  542. _st((function(){
  543. return smalltalk.withContext(function($ctx2) {
  544. return _st(i).__lt((5));
  545. $ctx2.sendIdx["<"]=1;
  546. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  547. return smalltalk.withContext(function($ctx2) {
  548. i=_st(i).__plus((1));
  549. $ctx2.sendIdx["+"]=1;
  550. return i;
  551. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  552. self._assert_equals_(i,(5));
  553. $ctx1.sendIdx["assert:equals:"]=1;
  554. i=(0);
  555. _st((function(){
  556. return smalltalk.withContext(function($ctx2) {
  557. i=_st(i).__plus((1));
  558. i;
  559. return _st(i).__lt((5));
  560. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileTrue();
  561. self._assert_equals_(i,(5));
  562. return self}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},globals.BlockClosureTest)})},
  563. args: [],
  564. source: "testWhileTrue\x0a\x09| i |\x0a\x09i := 0.\x0a\x09[ i < 5 ] whileTrue: [ i := i + 1 ].\x0a\x09self assert: i equals: 5.\x0a\x0a\x09i := 0.\x0a\x09[ i := i + 1. i < 5 ] whileTrue.\x0a\x09self assert: i equals: 5",
  565. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"],
  566. referencedClasses: []
  567. }),
  568. globals.BlockClosureTest);
  569. smalltalk.addClass('BooleanTest', globals.TestCase, [], 'Kernel-Tests');
  570. smalltalk.addMethod(
  571. smalltalk.method({
  572. selector: "testEquality",
  573. protocol: 'tests',
  574. fn: function (){
  575. var self=this;
  576. return smalltalk.withContext(function($ctx1) {
  577. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  578. $1=(0).__eq(false);
  579. $ctx1.sendIdx["="]=1;
  580. self._deny_($1);
  581. $ctx1.sendIdx["deny:"]=1;
  582. $2=false.__eq((0));
  583. $ctx1.sendIdx["="]=2;
  584. self._deny_($2);
  585. $ctx1.sendIdx["deny:"]=2;
  586. $3="".__eq(false);
  587. $ctx1.sendIdx["="]=3;
  588. self._deny_($3);
  589. $ctx1.sendIdx["deny:"]=3;
  590. $4=false.__eq("");
  591. $ctx1.sendIdx["="]=4;
  592. self._deny_($4);
  593. $ctx1.sendIdx["deny:"]=4;
  594. $5=true.__eq(true);
  595. $ctx1.sendIdx["="]=5;
  596. self._assert_($5);
  597. $ctx1.sendIdx["assert:"]=1;
  598. $6=false.__eq(true);
  599. $ctx1.sendIdx["="]=6;
  600. self._deny_($6);
  601. $ctx1.sendIdx["deny:"]=5;
  602. $7=true.__eq(false);
  603. $ctx1.sendIdx["="]=7;
  604. self._deny_($7);
  605. $8=false.__eq(false);
  606. $ctx1.sendIdx["="]=8;
  607. self._assert_($8);
  608. $ctx1.sendIdx["assert:"]=2;
  609. $10=true._yourself();
  610. $ctx1.sendIdx["yourself"]=1;
  611. $9=_st($10).__eq(true);
  612. $ctx1.sendIdx["="]=9;
  613. self._assert_($9);
  614. $ctx1.sendIdx["assert:"]=3;
  615. $12=true._yourself();
  616. $ctx1.sendIdx["yourself"]=2;
  617. $11=_st($12).__eq(true._yourself());
  618. self._assert_($11);
  619. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.BooleanTest)})},
  620. args: [],
  621. source: "testEquality\x0a\x09\x22We're on top of JS...just be sure to check the basics!\x22\x0a\x0a\x09self deny: 0 = false.\x0a\x09self deny: false = 0.\x0a\x09self deny: '' = false.\x0a\x09self deny: false = ''.\x0a\x0a\x09self assert: (true = true).\x0a\x09self deny: false = true.\x0a\x09self deny: true = false.\x0a\x09self assert: (false = false).\x0a\x0a\x09\x22JS may do some type coercing after sending a message\x22\x0a\x09self assert: (true yourself = true).\x0a\x09self assert: (true yourself = true yourself)",
  622. messageSends: ["deny:", "=", "assert:", "yourself"],
  623. referencedClasses: []
  624. }),
  625. globals.BooleanTest);
  626. smalltalk.addMethod(
  627. smalltalk.method({
  628. selector: "testIdentity",
  629. protocol: 'tests',
  630. fn: function (){
  631. var self=this;
  632. return smalltalk.withContext(function($ctx1) {
  633. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  634. $1=(0).__eq_eq(false);
  635. $ctx1.sendIdx["=="]=1;
  636. self._deny_($1);
  637. $ctx1.sendIdx["deny:"]=1;
  638. $2=false.__eq_eq((0));
  639. $ctx1.sendIdx["=="]=2;
  640. self._deny_($2);
  641. $ctx1.sendIdx["deny:"]=2;
  642. $3="".__eq_eq(false);
  643. $ctx1.sendIdx["=="]=3;
  644. self._deny_($3);
  645. $ctx1.sendIdx["deny:"]=3;
  646. $4=false.__eq_eq("");
  647. $ctx1.sendIdx["=="]=4;
  648. self._deny_($4);
  649. $ctx1.sendIdx["deny:"]=4;
  650. $5=true.__eq_eq(true);
  651. $ctx1.sendIdx["=="]=5;
  652. self._assert_($5);
  653. $ctx1.sendIdx["assert:"]=1;
  654. $6=false.__eq_eq(true);
  655. $ctx1.sendIdx["=="]=6;
  656. self._deny_($6);
  657. $ctx1.sendIdx["deny:"]=5;
  658. $7=true.__eq_eq(false);
  659. $ctx1.sendIdx["=="]=7;
  660. self._deny_($7);
  661. $8=false.__eq_eq(false);
  662. $ctx1.sendIdx["=="]=8;
  663. self._assert_($8);
  664. $ctx1.sendIdx["assert:"]=2;
  665. $10=true._yourself();
  666. $ctx1.sendIdx["yourself"]=1;
  667. $9=_st($10).__eq_eq(true);
  668. $ctx1.sendIdx["=="]=9;
  669. self._assert_($9);
  670. $ctx1.sendIdx["assert:"]=3;
  671. $12=true._yourself();
  672. $ctx1.sendIdx["yourself"]=2;
  673. $11=_st($12).__eq_eq(true._yourself());
  674. self._assert_($11);
  675. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.BooleanTest)})},
  676. args: [],
  677. source: "testIdentity\x0a\x09\x22We're on top of JS...just be sure to check the basics!\x22\x0a\x0a\x09self deny: 0 == false.\x0a\x09self deny: false == 0.\x0a\x09self deny: '' == false.\x0a\x09self deny: false == ''.\x0a\x0a\x09self assert: true == true.\x0a\x09self deny: false == true.\x0a\x09self deny: true == false.\x0a\x09self assert: false == false.\x0a\x0a\x09\x22JS may do some type coercing after sending a message\x22\x0a\x09self assert: true yourself == true.\x0a\x09self assert: true yourself == true yourself",
  678. messageSends: ["deny:", "==", "assert:", "yourself"],
  679. referencedClasses: []
  680. }),
  681. globals.BooleanTest);
  682. smalltalk.addMethod(
  683. smalltalk.method({
  684. selector: "testIfTrueIfFalse",
  685. protocol: 'tests',
  686. fn: function (){
  687. var self=this;
  688. return smalltalk.withContext(function($ctx1) {
  689. var $1,$2,$3,$4,$5,$6,$7,$8;
  690. if(smalltalk.assert(true)){
  691. $1="alternative block";
  692. };
  693. self._assert_equals_($1,"alternative block");
  694. $ctx1.sendIdx["assert:equals:"]=1;
  695. if(! smalltalk.assert(true)){
  696. $2="alternative block";
  697. };
  698. self._assert_equals_($2,nil);
  699. $ctx1.sendIdx["assert:equals:"]=2;
  700. if(smalltalk.assert(false)){
  701. $3="alternative block";
  702. };
  703. self._assert_equals_($3,nil);
  704. $ctx1.sendIdx["assert:equals:"]=3;
  705. if(! smalltalk.assert(false)){
  706. $4="alternative block";
  707. };
  708. self._assert_equals_($4,"alternative block");
  709. $ctx1.sendIdx["assert:equals:"]=4;
  710. if(smalltalk.assert(false)){
  711. $5="alternative block";
  712. } else {
  713. $5="alternative block2";
  714. };
  715. self._assert_equals_($5,"alternative block2");
  716. $ctx1.sendIdx["assert:equals:"]=5;
  717. if(smalltalk.assert(false)){
  718. $6="alternative block2";
  719. } else {
  720. $6="alternative block";
  721. };
  722. self._assert_equals_($6,"alternative block");
  723. $ctx1.sendIdx["assert:equals:"]=6;
  724. if(smalltalk.assert(true)){
  725. $7="alternative block";
  726. } else {
  727. $7="alternative block2";
  728. };
  729. self._assert_equals_($7,"alternative block");
  730. $ctx1.sendIdx["assert:equals:"]=7;
  731. if(smalltalk.assert(true)){
  732. $8="alternative block2";
  733. } else {
  734. $8="alternative block";
  735. };
  736. self._assert_equals_($8,"alternative block2");
  737. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},globals.BooleanTest)})},
  738. args: [],
  739. source: "testIfTrueIfFalse\x0a\x0a\x09self assert: (true ifTrue: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x09self assert: (true ifFalse: [ 'alternative block' ]) equals: nil.\x0a\x0a\x09self assert: (false ifTrue: [ 'alternative block' ]) equals: nil.\x0a\x09self assert: (false ifFalse: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (false ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block2'.\x0a\x09self assert: (false ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (true ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x09self assert: (true ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block2'.",
  740. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  741. referencedClasses: []
  742. }),
  743. globals.BooleanTest);
  744. smalltalk.addMethod(
  745. smalltalk.method({
  746. selector: "testIfTrueIfFalseWithBoxing",
  747. protocol: 'tests',
  748. fn: function (){
  749. var self=this;
  750. return smalltalk.withContext(function($ctx1) {
  751. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  752. $2=true._yourself();
  753. $ctx1.sendIdx["yourself"]=1;
  754. if(smalltalk.assert($2)){
  755. $1="alternative block";
  756. };
  757. self._assert_equals_($1,"alternative block");
  758. $ctx1.sendIdx["assert:equals:"]=1;
  759. $4=true._yourself();
  760. $ctx1.sendIdx["yourself"]=2;
  761. if(! smalltalk.assert($4)){
  762. $3="alternative block";
  763. };
  764. self._assert_equals_($3,nil);
  765. $ctx1.sendIdx["assert:equals:"]=2;
  766. $6=false._yourself();
  767. $ctx1.sendIdx["yourself"]=3;
  768. if(smalltalk.assert($6)){
  769. $5="alternative block";
  770. };
  771. self._assert_equals_($5,nil);
  772. $ctx1.sendIdx["assert:equals:"]=3;
  773. $8=false._yourself();
  774. $ctx1.sendIdx["yourself"]=4;
  775. if(! smalltalk.assert($8)){
  776. $7="alternative block";
  777. };
  778. self._assert_equals_($7,"alternative block");
  779. $ctx1.sendIdx["assert:equals:"]=4;
  780. $10=false._yourself();
  781. $ctx1.sendIdx["yourself"]=5;
  782. if(smalltalk.assert($10)){
  783. $9="alternative block";
  784. } else {
  785. $9="alternative block2";
  786. };
  787. self._assert_equals_($9,"alternative block2");
  788. $ctx1.sendIdx["assert:equals:"]=5;
  789. $12=false._yourself();
  790. $ctx1.sendIdx["yourself"]=6;
  791. if(smalltalk.assert($12)){
  792. $11="alternative block2";
  793. } else {
  794. $11="alternative block";
  795. };
  796. self._assert_equals_($11,"alternative block");
  797. $ctx1.sendIdx["assert:equals:"]=6;
  798. $14=true._yourself();
  799. $ctx1.sendIdx["yourself"]=7;
  800. if(smalltalk.assert($14)){
  801. $13="alternative block";
  802. } else {
  803. $13="alternative block2";
  804. };
  805. self._assert_equals_($13,"alternative block");
  806. $ctx1.sendIdx["assert:equals:"]=7;
  807. $16=true._yourself();
  808. if(smalltalk.assert($16)){
  809. $15="alternative block2";
  810. } else {
  811. $15="alternative block";
  812. };
  813. self._assert_equals_($15,"alternative block2");
  814. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},globals.BooleanTest)})},
  815. args: [],
  816. source: "testIfTrueIfFalseWithBoxing\x0a\x0a\x09self assert: (true yourself ifTrue: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: [ 'alternative block' ]) equals: nil.\x0a\x0a\x09self assert: (false yourself ifTrue: [ 'alternative block' ]) equals: nil.\x0a\x09self assert: (false yourself ifFalse: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (false yourself ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block2'.\x0a\x09self assert: (false yourself ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (true yourself ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block2'.",
  817. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  818. referencedClasses: []
  819. }),
  820. globals.BooleanTest);
  821. smalltalk.addMethod(
  822. smalltalk.method({
  823. selector: "testLogic",
  824. protocol: 'tests',
  825. fn: function (){
  826. var self=this;
  827. return smalltalk.withContext(function($ctx1) {
  828. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$17,$18,$16,$15,$20,$19,$22,$21,$25,$24,$23;
  829. $1=true.__and(true);
  830. $ctx1.sendIdx["&"]=1;
  831. self._assert_($1);
  832. $ctx1.sendIdx["assert:"]=1;
  833. $2=true.__and(false);
  834. $ctx1.sendIdx["&"]=2;
  835. self._deny_($2);
  836. $ctx1.sendIdx["deny:"]=1;
  837. $3=false.__and(true);
  838. $ctx1.sendIdx["&"]=3;
  839. self._deny_($3);
  840. $ctx1.sendIdx["deny:"]=2;
  841. $5=false.__and(false);
  842. $ctx1.sendIdx["&"]=4;
  843. $4=self._deny_($5);
  844. $ctx1.sendIdx["deny:"]=3;
  845. $6=true.__or(true);
  846. $ctx1.sendIdx["|"]=1;
  847. self._assert_($6);
  848. $ctx1.sendIdx["assert:"]=2;
  849. $7=true.__or(false);
  850. $ctx1.sendIdx["|"]=2;
  851. self._assert_($7);
  852. $ctx1.sendIdx["assert:"]=3;
  853. $8=false.__or(true);
  854. $ctx1.sendIdx["|"]=3;
  855. self._assert_($8);
  856. $ctx1.sendIdx["assert:"]=4;
  857. $10=false.__or(false);
  858. $ctx1.sendIdx["|"]=4;
  859. $9=self._deny_($10);
  860. $ctx1.sendIdx["deny:"]=4;
  861. $12=(1).__gt((0));
  862. $ctx1.sendIdx[">"]=1;
  863. $11=true.__and($12);
  864. $ctx1.sendIdx["&"]=5;
  865. self._assert_($11);
  866. $ctx1.sendIdx["assert:"]=5;
  867. $14=(1).__gt((0));
  868. $ctx1.sendIdx[">"]=2;
  869. $13=_st($14).__and(false);
  870. $ctx1.sendIdx["&"]=6;
  871. self._deny_($13);
  872. $ctx1.sendIdx["deny:"]=5;
  873. $17=(1).__gt((0));
  874. $ctx1.sendIdx[">"]=3;
  875. $18=(1).__gt((2));
  876. $ctx1.sendIdx[">"]=4;
  877. $16=_st($17).__and($18);
  878. $15=self._deny_($16);
  879. $20=(1).__gt((0));
  880. $ctx1.sendIdx[">"]=5;
  881. $19=false.__or($20);
  882. $ctx1.sendIdx["|"]=5;
  883. self._assert_($19);
  884. $ctx1.sendIdx["assert:"]=6;
  885. $22=(1).__gt((0));
  886. $ctx1.sendIdx[">"]=6;
  887. $21=_st($22).__or(false);
  888. $ctx1.sendIdx["|"]=6;
  889. self._assert_($21);
  890. $ctx1.sendIdx["assert:"]=7;
  891. $25=(1).__gt((0));
  892. $ctx1.sendIdx[">"]=7;
  893. $24=_st($25).__or((1).__gt((2)));
  894. $23=self._assert_($24);
  895. return self}, function($ctx1) {$ctx1.fill(self,"testLogic",{},globals.BooleanTest)})},
  896. args: [],
  897. source: "testLogic\x0a\x09\x22Trivial logic table\x22\x0a\x09self assert: (true & true);\x0a\x09\x09deny: (true & false);\x0a\x09\x09deny: (false & true);\x0a\x09\x09deny: (false & false).\x0a\x09self assert: (true | true);\x0a\x09\x09assert: (true | false);\x0a\x09\x09assert: (false | true);\x0a\x09\x09deny: (false | false).\x0a\x09\x22Checking that expressions work fine too\x22\x0a\x09self assert: (true & (1 > 0));\x0a\x09\x09deny: ((1 > 0) & false);\x0a\x09\x09deny: ((1 > 0) & (1 > 2)).\x0a\x09self assert: (false | (1 > 0));\x0a\x09\x09assert: ((1 > 0) | false);\x0a\x09\x09assert: ((1 > 0) | (1 > 2))",
  898. messageSends: ["assert:", "&", "deny:", "|", ">"],
  899. referencedClasses: []
  900. }),
  901. globals.BooleanTest);
  902. smalltalk.addMethod(
  903. smalltalk.method({
  904. selector: "testLogicKeywords",
  905. protocol: 'tests',
  906. fn: function (){
  907. var self=this;
  908. return smalltalk.withContext(function($ctx1) {
  909. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$16,$15,$14,$17,$19,$18,$22,$21,$20;
  910. $1=true._and_((function(){
  911. return true;
  912. }));
  913. $ctx1.sendIdx["and:"]=1;
  914. self._assert_($1);
  915. $ctx1.sendIdx["assert:"]=1;
  916. $2=true._and_((function(){
  917. return false;
  918. }));
  919. $ctx1.sendIdx["and:"]=2;
  920. self._deny_($2);
  921. $ctx1.sendIdx["deny:"]=1;
  922. $3=false._and_((function(){
  923. return true;
  924. }));
  925. $ctx1.sendIdx["and:"]=3;
  926. self._deny_($3);
  927. $ctx1.sendIdx["deny:"]=2;
  928. $5=false._and_((function(){
  929. return false;
  930. }));
  931. $ctx1.sendIdx["and:"]=4;
  932. $4=self._deny_($5);
  933. $ctx1.sendIdx["deny:"]=3;
  934. $6=true._or_((function(){
  935. return true;
  936. }));
  937. $ctx1.sendIdx["or:"]=1;
  938. self._assert_($6);
  939. $ctx1.sendIdx["assert:"]=2;
  940. $7=true._or_((function(){
  941. return false;
  942. }));
  943. $ctx1.sendIdx["or:"]=2;
  944. self._assert_($7);
  945. $ctx1.sendIdx["assert:"]=3;
  946. $8=false._or_((function(){
  947. return true;
  948. }));
  949. $ctx1.sendIdx["or:"]=3;
  950. self._assert_($8);
  951. $ctx1.sendIdx["assert:"]=4;
  952. $10=false._or_((function(){
  953. return false;
  954. }));
  955. $ctx1.sendIdx["or:"]=4;
  956. $9=self._deny_($10);
  957. $ctx1.sendIdx["deny:"]=4;
  958. $11=true._and_((function(){
  959. return smalltalk.withContext(function($ctx2) {
  960. return (1).__gt((0));
  961. $ctx2.sendIdx[">"]=1;
  962. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}));
  963. $ctx1.sendIdx["and:"]=5;
  964. self._assert_($11);
  965. $ctx1.sendIdx["assert:"]=5;
  966. $13=(1).__gt((0));
  967. $ctx1.sendIdx[">"]=2;
  968. $12=_st($13)._and_((function(){
  969. return false;
  970. }));
  971. $ctx1.sendIdx["and:"]=6;
  972. self._deny_($12);
  973. $ctx1.sendIdx["deny:"]=5;
  974. $16=(1).__gt((0));
  975. $ctx1.sendIdx[">"]=3;
  976. $15=_st($16)._and_((function(){
  977. return smalltalk.withContext(function($ctx2) {
  978. return (1).__gt((2));
  979. $ctx2.sendIdx[">"]=4;
  980. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}));
  981. $14=self._deny_($15);
  982. $17=false._or_((function(){
  983. return smalltalk.withContext(function($ctx2) {
  984. return (1).__gt((0));
  985. $ctx2.sendIdx[">"]=5;
  986. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}));
  987. $ctx1.sendIdx["or:"]=5;
  988. self._assert_($17);
  989. $ctx1.sendIdx["assert:"]=6;
  990. $19=(1).__gt((0));
  991. $ctx1.sendIdx[">"]=6;
  992. $18=_st($19)._or_((function(){
  993. return false;
  994. }));
  995. $ctx1.sendIdx["or:"]=6;
  996. self._assert_($18);
  997. $ctx1.sendIdx["assert:"]=7;
  998. $22=(1).__gt((0));
  999. $ctx1.sendIdx[">"]=7;
  1000. $21=_st($22)._or_((function(){
  1001. return smalltalk.withContext(function($ctx2) {
  1002. return (1).__gt((2));
  1003. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}));
  1004. $20=self._assert_($21);
  1005. return self}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},globals.BooleanTest)})},
  1006. args: [],
  1007. source: "testLogicKeywords\x0a\x09\x22Trivial logic table\x22\x0a\x09self\x0a\x09\x09assert: (true and: [ true ]);\x0a\x09\x09deny: (true and: [ false ]);\x0a\x09\x09deny: (false and: [ true ]);\x0a\x09\x09deny: (false and: [ false ]).\x0a\x09self\x0a\x09\x09assert: (true or: [ true ]);\x0a\x09\x09assert: (true or: [ false ]);\x0a\x09\x09assert: (false or: [ true ]);\x0a\x09\x09deny: (false or: [ false ]).\x0a\x09\x09\x0a\x09\x22Checking that expressions work fine too\x22\x0a\x09self\x0a\x09\x09assert: (true and: [ 1 > 0 ]);\x0a\x09\x09deny: ((1 > 0) and: [ false ]);\x0a\x09\x09deny: ((1 > 0) and: [ 1 > 2 ]).\x0a\x09self\x0a\x09\x09assert: (false or: [ 1 > 0 ]);\x0a\x09\x09assert: ((1 > 0) or: [ false ]);\x0a\x09\x09assert: ((1 > 0) or: [ 1 > 2 ])",
  1008. messageSends: ["assert:", "and:", "deny:", "or:", ">"],
  1009. referencedClasses: []
  1010. }),
  1011. globals.BooleanTest);
  1012. smalltalk.addMethod(
  1013. smalltalk.method({
  1014. selector: "testNonBooleanError",
  1015. protocol: 'tests',
  1016. fn: function (){
  1017. var self=this;
  1018. function $NonBooleanReceiver(){return globals.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  1019. return smalltalk.withContext(function($ctx1) {
  1020. self._should_raise_((function(){
  1021. return smalltalk.withContext(function($ctx2) {
  1022. if(smalltalk.assert("")){
  1023. } else {
  1024. };
  1025. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$NonBooleanReceiver());
  1026. return self}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},globals.BooleanTest)})},
  1027. args: [],
  1028. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  1029. messageSends: ["should:raise:", "ifTrue:ifFalse:"],
  1030. referencedClasses: ["NonBooleanReceiver"]
  1031. }),
  1032. globals.BooleanTest);
  1033. smalltalk.addClass('ClassBuilderTest', globals.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  1034. smalltalk.addMethod(
  1035. smalltalk.method({
  1036. selector: "setUp",
  1037. protocol: 'running',
  1038. fn: function (){
  1039. var self=this;
  1040. function $ClassBuilder(){return globals.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  1041. return smalltalk.withContext(function($ctx1) {
  1042. self["@builder"]=_st($ClassBuilder())._new();
  1043. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.ClassBuilderTest)})},
  1044. args: [],
  1045. source: "setUp\x0a\x09builder := ClassBuilder new",
  1046. messageSends: ["new"],
  1047. referencedClasses: ["ClassBuilder"]
  1048. }),
  1049. globals.ClassBuilderTest);
  1050. smalltalk.addMethod(
  1051. smalltalk.method({
  1052. selector: "tearDown",
  1053. protocol: 'running',
  1054. fn: function (){
  1055. var self=this;
  1056. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1057. return smalltalk.withContext(function($ctx1) {
  1058. var $1,$receiver;
  1059. $1=self["@theClass"];
  1060. if(($receiver = $1) == null || $receiver.isNil){
  1061. $1;
  1062. } else {
  1063. _st($Smalltalk())._removeClass_(self["@theClass"]);
  1064. self["@theClass"]=nil;
  1065. self["@theClass"];
  1066. };
  1067. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},globals.ClassBuilderTest)})},
  1068. args: [],
  1069. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk removeClass: theClass. theClass := nil ]",
  1070. messageSends: ["ifNotNil:", "removeClass:"],
  1071. referencedClasses: ["Smalltalk"]
  1072. }),
  1073. globals.ClassBuilderTest);
  1074. smalltalk.addMethod(
  1075. smalltalk.method({
  1076. selector: "testClassCopy",
  1077. protocol: 'tests',
  1078. fn: function (){
  1079. var self=this;
  1080. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1081. return smalltalk.withContext(function($ctx1) {
  1082. var $2,$1,$4,$3,$6,$5,$8,$7;
  1083. self["@theClass"]=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1084. $2=_st(self["@theClass"])._superclass();
  1085. $ctx1.sendIdx["superclass"]=1;
  1086. $1=_st($2).__eq_eq(_st($ObjectMock())._superclass());
  1087. $ctx1.sendIdx["=="]=1;
  1088. self._assert_($1);
  1089. $ctx1.sendIdx["assert:"]=1;
  1090. $4=_st(self["@theClass"])._instanceVariableNames();
  1091. $ctx1.sendIdx["instanceVariableNames"]=1;
  1092. $3=_st($4).__eq_eq(_st($ObjectMock())._instanceVariableNames());
  1093. $ctx1.sendIdx["=="]=2;
  1094. self._assert_($3);
  1095. $ctx1.sendIdx["assert:"]=2;
  1096. self._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  1097. $ctx1.sendIdx["assert:equals:"]=1;
  1098. $6=_st(self["@theClass"])._package();
  1099. $ctx1.sendIdx["package"]=1;
  1100. $5=_st($6).__eq_eq(_st($ObjectMock())._package());
  1101. self._assert_($5);
  1102. $8=_st(self["@theClass"])._methodDictionary();
  1103. $ctx1.sendIdx["methodDictionary"]=1;
  1104. $7=_st($8)._keys();
  1105. $ctx1.sendIdx["keys"]=1;
  1106. self._assert_equals_($7,_st(_st($ObjectMock())._methodDictionary())._keys());
  1107. return self}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},globals.ClassBuilderTest)})},
  1108. args: [],
  1109. source: "testClassCopy\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09self assert: theClass superclass == ObjectMock superclass.\x0a\x09self assert: theClass instanceVariableNames == ObjectMock instanceVariableNames.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: theClass package == ObjectMock package.\x0a\x09self assert: theClass methodDictionary keys equals: ObjectMock methodDictionary keys",
  1110. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"],
  1111. referencedClasses: ["ObjectMock"]
  1112. }),
  1113. globals.ClassBuilderTest);
  1114. smalltalk.addMethod(
  1115. smalltalk.method({
  1116. selector: "testClassMigration",
  1117. protocol: 'tests',
  1118. fn: function (){
  1119. var self=this;
  1120. var instance,oldClass;
  1121. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1122. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1123. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1124. return smalltalk.withContext(function($ctx1) {
  1125. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10;
  1126. oldClass=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1127. $2=_st($Smalltalk())._globals();
  1128. $ctx1.sendIdx["globals"]=1;
  1129. $1=_st($2)._at_("ObjectMock2");
  1130. $ctx1.sendIdx["at:"]=1;
  1131. instance=_st($1)._new();
  1132. $4=_st($Smalltalk())._globals();
  1133. $ctx1.sendIdx["globals"]=2;
  1134. $3=_st($4)._at_("ObjectMock2");
  1135. $ctx1.sendIdx["at:"]=2;
  1136. _st($ObjectMock())._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  1137. $5=_st(oldClass).__eq_eq($ObjectMock2());
  1138. $ctx1.sendIdx["=="]=1;
  1139. self._deny_($5);
  1140. $ctx1.sendIdx["deny:"]=1;
  1141. $6=_st(_st($ObjectMock2())._superclass()).__eq_eq($ObjectMock());
  1142. $ctx1.sendIdx["=="]=2;
  1143. self._assert_($6);
  1144. $ctx1.sendIdx["assert:"]=1;
  1145. self._assert_(_st(_st($ObjectMock2())._instanceVariableNames())._isEmpty());
  1146. $ctx1.sendIdx["assert:"]=2;
  1147. $7=_st($ObjectMock2())._selectors();
  1148. $ctx1.sendIdx["selectors"]=1;
  1149. self._assert_equals_($7,_st(oldClass)._selectors());
  1150. $ctx1.sendIdx["assert:equals:"]=1;
  1151. $8=_st($ObjectMock2())._comment();
  1152. $ctx1.sendIdx["comment"]=1;
  1153. self._assert_equals_($8,_st(oldClass)._comment());
  1154. $ctx1.sendIdx["assert:equals:"]=2;
  1155. $9=_st(_st($ObjectMock2())._package())._name();
  1156. $ctx1.sendIdx["name"]=1;
  1157. self._assert_equals_($9,"Kernel-Tests");
  1158. $11=_st(instance)._class();
  1159. $ctx1.sendIdx["class"]=1;
  1160. $10=_st($11).__eq_eq($ObjectMock2());
  1161. self._deny_($10);
  1162. self._assert_(_st(_st(_st($Smalltalk())._globals())._at_(_st(_st(instance)._class())._name()))._isNil());
  1163. _st($Smalltalk())._removeClass_($ObjectMock2());
  1164. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},globals.ClassBuilderTest)})},
  1165. args: [],
  1166. source: "testClassMigration\x0a\x09| instance oldClass |\x0a\x09\x0a\x09oldClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09instance := (Smalltalk globals at: 'ObjectMock2') new.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: oldClass == ObjectMock2.\x0a\x09\x0a\x09self assert: ObjectMock2 superclass == ObjectMock.\x0a\x09self assert: ObjectMock2 instanceVariableNames isEmpty.\x0a\x09self assert: ObjectMock2 selectors equals: oldClass selectors.\x0a\x09self assert: ObjectMock2 comment equals: oldClass comment.\x0a\x09self assert: ObjectMock2 package name equals: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: instance class == ObjectMock2.\x0a\x09\x22Commeting this out. Tests implementation detail.\x22\x0a\x09\x22self assert: instance class name equals: 'OldObjectMock2'.\x22\x0a\x09\x0a\x09self assert: (Smalltalk globals at: instance class name) isNil.\x0a\x09\x0a\x09Smalltalk removeClass: ObjectMock2",
  1167. messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"],
  1168. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"]
  1169. }),
  1170. globals.ClassBuilderTest);
  1171. smalltalk.addMethod(
  1172. smalltalk.method({
  1173. selector: "testClassMigrationWithClassInstanceVariables",
  1174. protocol: 'tests',
  1175. fn: function (){
  1176. var self=this;
  1177. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1178. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1179. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1180. return smalltalk.withContext(function($ctx1) {
  1181. var $1;
  1182. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1183. $1=_st($ObjectMock2())._class();
  1184. $ctx1.sendIdx["class"]=1;
  1185. _st($1)._instanceVariableNames_("foo bar");
  1186. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  1187. self._assert_equals_(_st(_st($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  1188. _st($Smalltalk())._removeClass_($ObjectMock2());
  1189. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},globals.ClassBuilderTest)})},
  1190. args: [],
  1191. source: "testClassMigrationWithClassInstanceVariables\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 class instanceVariableNames: 'foo bar'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: ObjectMock2 class instanceVariableNames equals: #('foo' 'bar').\x0a\x09\x0a\x09Smalltalk removeClass: ObjectMock2",
  1192. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"],
  1193. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"]
  1194. }),
  1195. globals.ClassBuilderTest);
  1196. smalltalk.addMethod(
  1197. smalltalk.method({
  1198. selector: "testClassMigrationWithSubclasses",
  1199. protocol: 'tests',
  1200. fn: function (){
  1201. var self=this;
  1202. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1203. function $ObjectMock2(){return globals.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1204. function $ObjectMock3(){return globals.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  1205. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1206. function $ObjectMock4(){return globals.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  1207. return smalltalk.withContext(function($ctx1) {
  1208. var $2,$1,$4,$3;
  1209. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1210. _st($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  1211. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  1212. _st($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  1213. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  1214. _st($ObjectMock())._subclass_instanceVariableNames_package_(_st(_st($Smalltalk())._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  1215. $2=_st($ObjectMock())._subclasses();
  1216. $ctx1.sendIdx["subclasses"]=1;
  1217. $1=_st($2)._includes_($ObjectMock2());
  1218. $ctx1.sendIdx["includes:"]=1;
  1219. self._assert_($1);
  1220. $ctx1.sendIdx["assert:"]=1;
  1221. $4=_st($ObjectMock2())._subclasses();
  1222. $ctx1.sendIdx["subclasses"]=2;
  1223. $3=_st($4)._includes_($ObjectMock3());
  1224. $ctx1.sendIdx["includes:"]=2;
  1225. self._assert_($3);
  1226. $ctx1.sendIdx["assert:"]=2;
  1227. self._assert_(_st(_st($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  1228. _st(_st($ObjectMock())._allSubclasses())._do_((function(each){
  1229. return smalltalk.withContext(function($ctx2) {
  1230. return _st($Smalltalk())._removeClass_(each);
  1231. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1232. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},globals.ClassBuilderTest)})},
  1233. args: [],
  1234. source: "testClassMigrationWithSubclasses\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 subclass: 'ObjectMock3' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09ObjectMock3 subclass: 'ObjectMock4' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk globals at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: (ObjectMock subclasses includes: ObjectMock2).\x0a\x09self assert: (ObjectMock2 subclasses includes: ObjectMock3).\x0a\x09self assert: (ObjectMock3 subclasses includes: ObjectMock4).\x0a\x09\x0a\x09ObjectMock allSubclasses do: [ :each | Smalltalk removeClass: each ]",
  1235. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"],
  1236. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"]
  1237. }),
  1238. globals.ClassBuilderTest);
  1239. smalltalk.addMethod(
  1240. smalltalk.method({
  1241. selector: "testInstanceVariableNames",
  1242. protocol: 'tests',
  1243. fn: function (){
  1244. var self=this;
  1245. return smalltalk.withContext(function($ctx1) {
  1246. self._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  1247. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},globals.ClassBuilderTest)})},
  1248. args: [],
  1249. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  1250. messageSends: ["assert:equals:", "instanceVariableNamesFor:"],
  1251. referencedClasses: []
  1252. }),
  1253. globals.ClassBuilderTest);
  1254. smalltalk.addClass('CollectionTest', globals.TestCase, [], 'Kernel-Tests');
  1255. smalltalk.addMethod(
  1256. smalltalk.method({
  1257. selector: "assertSameContents:as:",
  1258. protocol: 'convenience',
  1259. fn: function (aCollection,anotherCollection){
  1260. var self=this;
  1261. return smalltalk.withContext(function($ctx1) {
  1262. var $2,$1,$4,$3;
  1263. $2=_st(aCollection)._size();
  1264. $ctx1.sendIdx["size"]=1;
  1265. $1=_st($2).__eq(_st(anotherCollection)._size());
  1266. $ctx1.sendIdx["="]=1;
  1267. self._assert_($1);
  1268. $ctx1.sendIdx["assert:"]=1;
  1269. _st(aCollection)._do_((function(each){
  1270. return smalltalk.withContext(function($ctx2) {
  1271. $4=_st(aCollection)._occurrencesOf_(each);
  1272. $ctx2.sendIdx["occurrencesOf:"]=1;
  1273. $3=_st($4).__eq(_st(anotherCollection)._occurrencesOf_(each));
  1274. return self._assert_($3);
  1275. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1276. return self}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},globals.CollectionTest)})},
  1277. args: ["aCollection", "anotherCollection"],
  1278. source: "assertSameContents: aCollection as: anotherCollection\x0a\x09self assert: (aCollection size = anotherCollection size).\x0a\x09aCollection do: [ :each |\x0a\x09\x09self assert: ((aCollection occurrencesOf: each) = (anotherCollection occurrencesOf: each)) ]",
  1279. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"],
  1280. referencedClasses: []
  1281. }),
  1282. globals.CollectionTest);
  1283. smalltalk.addMethod(
  1284. smalltalk.method({
  1285. selector: "collection",
  1286. protocol: 'fixture',
  1287. fn: function (){
  1288. var self=this;
  1289. return smalltalk.withContext(function($ctx1) {
  1290. self._subclassResponsibility();
  1291. return self}, function($ctx1) {$ctx1.fill(self,"collection",{},globals.CollectionTest)})},
  1292. args: [],
  1293. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  1294. messageSends: ["subclassResponsibility"],
  1295. referencedClasses: []
  1296. }),
  1297. globals.CollectionTest);
  1298. smalltalk.addMethod(
  1299. smalltalk.method({
  1300. selector: "collectionClass",
  1301. protocol: 'fixture',
  1302. fn: function (){
  1303. var self=this;
  1304. return smalltalk.withContext(function($ctx1) {
  1305. var $1;
  1306. $1=_st(self._class())._collectionClass();
  1307. return $1;
  1308. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},globals.CollectionTest)})},
  1309. args: [],
  1310. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  1311. messageSends: ["collectionClass", "class"],
  1312. referencedClasses: []
  1313. }),
  1314. globals.CollectionTest);
  1315. smalltalk.addMethod(
  1316. smalltalk.method({
  1317. selector: "collectionOfPrintStrings",
  1318. protocol: 'fixture',
  1319. fn: function (){
  1320. var self=this;
  1321. return smalltalk.withContext(function($ctx1) {
  1322. self._subclassResponsibility();
  1323. return self}, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.CollectionTest)})},
  1324. args: [],
  1325. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  1326. messageSends: ["subclassResponsibility"],
  1327. referencedClasses: []
  1328. }),
  1329. globals.CollectionTest);
  1330. smalltalk.addMethod(
  1331. smalltalk.method({
  1332. selector: "collectionSize",
  1333. protocol: 'fixture',
  1334. fn: function (){
  1335. var self=this;
  1336. return smalltalk.withContext(function($ctx1) {
  1337. self._subclassResponsibility();
  1338. return self}, function($ctx1) {$ctx1.fill(self,"collectionSize",{},globals.CollectionTest)})},
  1339. args: [],
  1340. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  1341. messageSends: ["subclassResponsibility"],
  1342. referencedClasses: []
  1343. }),
  1344. globals.CollectionTest);
  1345. smalltalk.addMethod(
  1346. smalltalk.method({
  1347. selector: "collectionWithDuplicates",
  1348. protocol: 'fixture',
  1349. fn: function (){
  1350. var self=this;
  1351. return smalltalk.withContext(function($ctx1) {
  1352. self._subclassResponsibility();
  1353. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.CollectionTest)})},
  1354. args: [],
  1355. source: "collectionWithDuplicates\x0a\x09\x22Answers pre-filled collection of type tested,\x0a\x09with exactly five distinct elements,\x0a\x09some of them appearing multiple times, if possible.\x22\x0a\x0a\x09self subclassResponsibility",
  1356. messageSends: ["subclassResponsibility"],
  1357. referencedClasses: []
  1358. }),
  1359. globals.CollectionTest);
  1360. smalltalk.addMethod(
  1361. smalltalk.method({
  1362. selector: "collectionWithNewValue",
  1363. protocol: 'fixture',
  1364. fn: function (){
  1365. var self=this;
  1366. return smalltalk.withContext(function($ctx1) {
  1367. self._subclassResponsibility();
  1368. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.CollectionTest)})},
  1369. args: [],
  1370. source: "collectionWithNewValue\x0a\x09\x22Answers a collection which shows how\x0a\x09self collection would look after adding\x0a\x09self sampleNewValue\x22\x0a\x09\x0a\x09self subclassResponsibility",
  1371. messageSends: ["subclassResponsibility"],
  1372. referencedClasses: []
  1373. }),
  1374. globals.CollectionTest);
  1375. smalltalk.addMethod(
  1376. smalltalk.method({
  1377. selector: "isCollectionReadOnly",
  1378. protocol: 'testing',
  1379. fn: function (){
  1380. var self=this;
  1381. return false;
  1382. },
  1383. args: [],
  1384. source: "isCollectionReadOnly\x0a\x09^ false",
  1385. messageSends: [],
  1386. referencedClasses: []
  1387. }),
  1388. globals.CollectionTest);
  1389. smalltalk.addMethod(
  1390. smalltalk.method({
  1391. selector: "sampleNewValue",
  1392. protocol: 'fixture',
  1393. fn: function (){
  1394. var self=this;
  1395. return "N";
  1396. },
  1397. args: [],
  1398. source: "sampleNewValue\x0a\x09\x22Answers a value that is not yet there\x0a\x09and can be put into a tested collection\x22\x0a\x09\x0a\x09^ 'N'",
  1399. messageSends: [],
  1400. referencedClasses: []
  1401. }),
  1402. globals.CollectionTest);
  1403. smalltalk.addMethod(
  1404. smalltalk.method({
  1405. selector: "sampleNewValueAsCollection",
  1406. protocol: 'fixture',
  1407. fn: function (){
  1408. var self=this;
  1409. return smalltalk.withContext(function($ctx1) {
  1410. var $1;
  1411. $1=_st(self._collectionClass())._with_(self._sampleNewValue());
  1412. return $1;
  1413. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},globals.CollectionTest)})},
  1414. args: [],
  1415. source: "sampleNewValueAsCollection\x0a\x09\x22Answers self sampleNewValue\x0a\x09wrapped in single element collection\x0a\x09of tested type\x22\x0a\x09\x0a\x09^ self collectionClass with: self sampleNewValue",
  1416. messageSends: ["with:", "collectionClass", "sampleNewValue"],
  1417. referencedClasses: []
  1418. }),
  1419. globals.CollectionTest);
  1420. smalltalk.addMethod(
  1421. smalltalk.method({
  1422. selector: "testAddAll",
  1423. protocol: 'tests',
  1424. fn: function (){
  1425. var self=this;
  1426. return smalltalk.withContext(function($ctx1) {
  1427. var $2,$3,$5,$4,$6,$1,$7,$10,$9,$11,$12,$13,$8,$14,$17,$16,$18,$20,$19,$21,$15,$23,$24,$25,$26,$22,$27,$28,$29;
  1428. $2=self._collection();
  1429. $ctx1.sendIdx["collection"]=1;
  1430. $3=$2;
  1431. $5=self._collectionClass();
  1432. $ctx1.sendIdx["collectionClass"]=1;
  1433. $4=_st($5)._new();
  1434. $ctx1.sendIdx["new"]=1;
  1435. _st($3)._addAll_($4);
  1436. $ctx1.sendIdx["addAll:"]=1;
  1437. $6=_st($2)._yourself();
  1438. $ctx1.sendIdx["yourself"]=1;
  1439. $1=$6;
  1440. $7=self._collection();
  1441. $ctx1.sendIdx["collection"]=2;
  1442. self._assert_equals_($1,$7);
  1443. $ctx1.sendIdx["assert:equals:"]=1;
  1444. $10=self._collectionClass();
  1445. $ctx1.sendIdx["collectionClass"]=2;
  1446. $9=_st($10)._new();
  1447. $ctx1.sendIdx["new"]=2;
  1448. $11=$9;
  1449. $12=self._collection();
  1450. $ctx1.sendIdx["collection"]=3;
  1451. _st($11)._addAll_($12);
  1452. $ctx1.sendIdx["addAll:"]=2;
  1453. $13=_st($9)._yourself();
  1454. $ctx1.sendIdx["yourself"]=2;
  1455. $8=$13;
  1456. $14=self._collection();
  1457. $ctx1.sendIdx["collection"]=4;
  1458. self._assert_equals_($8,$14);
  1459. $ctx1.sendIdx["assert:equals:"]=2;
  1460. $17=self._collectionClass();
  1461. $ctx1.sendIdx["collectionClass"]=3;
  1462. $16=_st($17)._new();
  1463. $ctx1.sendIdx["new"]=3;
  1464. $18=$16;
  1465. $20=self._collectionClass();
  1466. $ctx1.sendIdx["collectionClass"]=4;
  1467. $19=_st($20)._new();
  1468. $ctx1.sendIdx["new"]=4;
  1469. _st($18)._addAll_($19);
  1470. $ctx1.sendIdx["addAll:"]=3;
  1471. $21=_st($16)._yourself();
  1472. $ctx1.sendIdx["yourself"]=3;
  1473. $15=$21;
  1474. self._assert_equals_($15,_st(self._collectionClass())._new());
  1475. $ctx1.sendIdx["assert:equals:"]=3;
  1476. $23=self._collection();
  1477. $ctx1.sendIdx["collection"]=5;
  1478. $24=$23;
  1479. $25=self._sampleNewValueAsCollection();
  1480. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1481. _st($24)._addAll_($25);
  1482. $ctx1.sendIdx["addAll:"]=4;
  1483. $26=_st($23)._yourself();
  1484. $ctx1.sendIdx["yourself"]=4;
  1485. $22=$26;
  1486. $27=self._collectionWithNewValue();
  1487. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1488. self._assert_equals_($22,$27);
  1489. $28=self._sampleNewValueAsCollection();
  1490. _st($28)._addAll_(self._collection());
  1491. $29=_st($28)._yourself();
  1492. self._assertSameContents_as_($29,self._collectionWithNewValue());
  1493. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.CollectionTest)})},
  1494. args: [],
  1495. source: "testAddAll\x0a\x09self assert: (self collection addAll: self collectionClass new; yourself) equals: self collection.\x0a\x09self assert: (self collectionClass new addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collectionClass new addAll: self collectionClass new; yourself) equals: self collectionClass new.\x0a\x09self assert: (self collection addAll: self sampleNewValueAsCollection; yourself) equals: self collectionWithNewValue.\x0a\x09self assertSameContents: (self sampleNewValueAsCollection addAll: self collection; yourself) as: self collectionWithNewValue",
  1496. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1497. referencedClasses: []
  1498. }),
  1499. globals.CollectionTest);
  1500. smalltalk.addMethod(
  1501. smalltalk.method({
  1502. selector: "testAllSatisfy",
  1503. protocol: 'tests',
  1504. fn: function (){
  1505. var self=this;
  1506. var collection,anyOne;
  1507. return smalltalk.withContext(function($ctx1) {
  1508. var $1;
  1509. collection=self._collection();
  1510. anyOne=_st(collection)._anyOne();
  1511. $1=_st(collection)._allSatisfy_((function(each){
  1512. return smalltalk.withContext(function($ctx2) {
  1513. return _st(collection)._includes_(each);
  1514. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1515. $ctx1.sendIdx["allSatisfy:"]=1;
  1516. self._assert_($1);
  1517. self._deny_(_st(collection)._allSatisfy_((function(each){
  1518. return smalltalk.withContext(function($ctx2) {
  1519. return _st(each).__tild_eq(anyOne);
  1520. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1521. return self}, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},globals.CollectionTest)})},
  1522. args: [],
  1523. source: "testAllSatisfy\x0a\x09| collection anyOne |\x0a\x09collection := self collection.\x0a\x09anyOne := collection anyOne.\x0a\x09self assert: (collection allSatisfy: [ :each | collection includes: each ]).\x0a\x09self deny: (collection allSatisfy: [ :each | each ~= anyOne ])",
  1524. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="],
  1525. referencedClasses: []
  1526. }),
  1527. globals.CollectionTest);
  1528. smalltalk.addMethod(
  1529. smalltalk.method({
  1530. selector: "testAnyOne",
  1531. protocol: 'tests',
  1532. fn: function (){
  1533. var self=this;
  1534. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  1535. return smalltalk.withContext(function($ctx1) {
  1536. var $2,$1;
  1537. self._should_raise_((function(){
  1538. return smalltalk.withContext(function($ctx2) {
  1539. return _st(_st(self._collectionClass())._new())._anyOne();
  1540. $ctx2.sendIdx["anyOne"]=1;
  1541. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1542. $2=self._collection();
  1543. $ctx1.sendIdx["collection"]=1;
  1544. $1=_st($2)._includes_(_st(self._collection())._anyOne());
  1545. self._assert_($1);
  1546. return self}, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},globals.CollectionTest)})},
  1547. args: [],
  1548. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  1549. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"],
  1550. referencedClasses: ["Error"]
  1551. }),
  1552. globals.CollectionTest);
  1553. smalltalk.addMethod(
  1554. smalltalk.method({
  1555. selector: "testAnySatisfy",
  1556. protocol: 'tests',
  1557. fn: function (){
  1558. var self=this;
  1559. var anyOne;
  1560. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  1561. return smalltalk.withContext(function($ctx1) {
  1562. var $1,$3,$2;
  1563. $1=self._collection();
  1564. $ctx1.sendIdx["collection"]=1;
  1565. anyOne=_st($1)._anyOne();
  1566. $3=self._collection();
  1567. $ctx1.sendIdx["collection"]=2;
  1568. $2=_st($3)._anySatisfy_((function(each){
  1569. return smalltalk.withContext(function($ctx2) {
  1570. return _st(each).__eq(anyOne);
  1571. $ctx2.sendIdx["="]=1;
  1572. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1573. $ctx1.sendIdx["anySatisfy:"]=1;
  1574. self._assert_($2);
  1575. self._deny_(_st(self._collection())._anySatisfy_((function(each){
  1576. return smalltalk.withContext(function($ctx2) {
  1577. return _st(each).__eq(_st($Object())._new());
  1578. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1579. return self}, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},globals.CollectionTest)})},
  1580. args: [],
  1581. source: "testAnySatisfy\x0a\x09| anyOne |\x0a\x09anyOne := self collection anyOne.\x0a\x09self assert: (self collection anySatisfy: [ :each | each = anyOne ]).\x0a\x09self deny: (self collection anySatisfy: [ :each | each = Object new ])",
  1582. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"],
  1583. referencedClasses: ["Object"]
  1584. }),
  1585. globals.CollectionTest);
  1586. smalltalk.addMethod(
  1587. smalltalk.method({
  1588. selector: "testAsArray",
  1589. protocol: 'tests',
  1590. fn: function (){
  1591. var self=this;
  1592. return smalltalk.withContext(function($ctx1) {
  1593. var $1;
  1594. $1=self._collection();
  1595. $ctx1.sendIdx["collection"]=1;
  1596. self._assertSameContents_as_($1,_st(self._collection())._asArray());
  1597. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},globals.CollectionTest)})},
  1598. args: [],
  1599. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  1600. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  1601. referencedClasses: []
  1602. }),
  1603. globals.CollectionTest);
  1604. smalltalk.addMethod(
  1605. smalltalk.method({
  1606. selector: "testAsOrderedCollection",
  1607. protocol: 'tests',
  1608. fn: function (){
  1609. var self=this;
  1610. return smalltalk.withContext(function($ctx1) {
  1611. var $1;
  1612. $1=self._collection();
  1613. $ctx1.sendIdx["collection"]=1;
  1614. self._assertSameContents_as_($1,_st(self._collection())._asOrderedCollection());
  1615. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},globals.CollectionTest)})},
  1616. args: [],
  1617. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  1618. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  1619. referencedClasses: []
  1620. }),
  1621. globals.CollectionTest);
  1622. smalltalk.addMethod(
  1623. smalltalk.method({
  1624. selector: "testAsSet",
  1625. protocol: 'tests',
  1626. fn: function (){
  1627. var self=this;
  1628. var c,set;
  1629. return smalltalk.withContext(function($ctx1) {
  1630. c=self._collectionWithDuplicates();
  1631. set=_st(c)._asSet();
  1632. self._assert_equals_(_st(set)._size(),(5));
  1633. _st(c)._do_((function(each){
  1634. return smalltalk.withContext(function($ctx2) {
  1635. return self._assert_(_st(set)._includes_(each));
  1636. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1637. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},globals.CollectionTest)})},
  1638. args: [],
  1639. source: "testAsSet\x0a\x09| c set |\x0a\x09c := self collectionWithDuplicates.\x0a\x09set := c asSet.\x0a\x09self assert: set size equals: 5.\x0a\x09c do: [ :each |\x0a\x09\x09self assert: (set includes: each) ]",
  1640. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  1641. referencedClasses: []
  1642. }),
  1643. globals.CollectionTest);
  1644. smalltalk.addMethod(
  1645. smalltalk.method({
  1646. selector: "testCollect",
  1647. protocol: 'tests',
  1648. fn: function (){
  1649. var self=this;
  1650. return smalltalk.withContext(function($ctx1) {
  1651. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  1652. $2=self._collection();
  1653. $ctx1.sendIdx["collection"]=1;
  1654. $1=_st($2)._collect_((function(each){
  1655. return each;
  1656. }));
  1657. $ctx1.sendIdx["collect:"]=1;
  1658. $3=self._collection();
  1659. $ctx1.sendIdx["collection"]=2;
  1660. self._assert_equals_($1,$3);
  1661. $ctx1.sendIdx["assert:equals:"]=1;
  1662. $5=self._collectionWithNewValue();
  1663. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1664. $4=_st($5)._collect_((function(each){
  1665. return each;
  1666. }));
  1667. $ctx1.sendIdx["collect:"]=2;
  1668. self._assert_equals_($4,self._collectionWithNewValue());
  1669. $ctx1.sendIdx["assert:equals:"]=2;
  1670. $8=self._collectionClass();
  1671. $ctx1.sendIdx["collectionClass"]=1;
  1672. $7=_st($8)._new();
  1673. $ctx1.sendIdx["new"]=1;
  1674. $6=_st($7)._collect_((function(each){
  1675. return smalltalk.withContext(function($ctx2) {
  1676. return _st(each)._printString();
  1677. $ctx2.sendIdx["printString"]=1;
  1678. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  1679. $ctx1.sendIdx["collect:"]=3;
  1680. self._assert_equals_($6,_st(self._collectionClass())._new());
  1681. $ctx1.sendIdx["assert:equals:"]=3;
  1682. $11=self._collection();
  1683. $ctx1.sendIdx["collection"]=3;
  1684. $10=_st($11)._collect_((function(){
  1685. return smalltalk.withContext(function($ctx2) {
  1686. return self._sampleNewValue();
  1687. $ctx2.sendIdx["sampleNewValue"]=1;
  1688. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1689. $ctx1.sendIdx["collect:"]=4;
  1690. $9=_st($10)._detect_((function(){
  1691. return true;
  1692. }));
  1693. self._assert_equals_($9,self._sampleNewValue());
  1694. $ctx1.sendIdx["assert:equals:"]=4;
  1695. self._assert_equals_(_st(self._collection())._collect_((function(each){
  1696. return smalltalk.withContext(function($ctx2) {
  1697. return _st(each)._printString();
  1698. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collectionOfPrintStrings());
  1699. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},globals.CollectionTest)})},
  1700. args: [],
  1701. source: "testCollect\x0a\x09self assert: (self collection collect: [ :each | each ]) equals: self collection.\x0a\x09self assert: (self collectionWithNewValue collect: [ :each | each ]) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionClass new collect: [ :each | each printString ]) equals: self collectionClass new.\x0a\x09self assert: ((self collection collect: [ self sampleNewValue ]) detect: [ true ]) equals: self sampleNewValue.\x0a\x09self assert: (self collection collect: [ :each | each printString ]) equals: self collectionOfPrintStrings",
  1702. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"],
  1703. referencedClasses: []
  1704. }),
  1705. globals.CollectionTest);
  1706. smalltalk.addMethod(
  1707. smalltalk.method({
  1708. selector: "testComma",
  1709. protocol: 'tests',
  1710. fn: function (){
  1711. var self=this;
  1712. return smalltalk.withContext(function($ctx1) {
  1713. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  1714. $2=self._collection();
  1715. $ctx1.sendIdx["collection"]=1;
  1716. $4=self._collectionClass();
  1717. $ctx1.sendIdx["collectionClass"]=1;
  1718. $3=_st($4)._new();
  1719. $ctx1.sendIdx["new"]=1;
  1720. $1=_st($2).__comma($3);
  1721. $ctx1.sendIdx[","]=1;
  1722. $5=self._collection();
  1723. $ctx1.sendIdx["collection"]=2;
  1724. self._assert_equals_($1,$5);
  1725. $ctx1.sendIdx["assert:equals:"]=1;
  1726. $8=self._collectionClass();
  1727. $ctx1.sendIdx["collectionClass"]=2;
  1728. $7=_st($8)._new();
  1729. $ctx1.sendIdx["new"]=2;
  1730. $9=self._collection();
  1731. $ctx1.sendIdx["collection"]=3;
  1732. $6=_st($7).__comma($9);
  1733. $ctx1.sendIdx[","]=2;
  1734. $10=self._collection();
  1735. $ctx1.sendIdx["collection"]=4;
  1736. self._assert_equals_($6,$10);
  1737. $ctx1.sendIdx["assert:equals:"]=2;
  1738. $13=self._collectionClass();
  1739. $ctx1.sendIdx["collectionClass"]=3;
  1740. $12=_st($13)._new();
  1741. $ctx1.sendIdx["new"]=3;
  1742. $15=self._collectionClass();
  1743. $ctx1.sendIdx["collectionClass"]=4;
  1744. $14=_st($15)._new();
  1745. $ctx1.sendIdx["new"]=4;
  1746. $11=_st($12).__comma($14);
  1747. $ctx1.sendIdx[","]=3;
  1748. self._assert_equals_($11,_st(self._collectionClass())._new());
  1749. $ctx1.sendIdx["assert:equals:"]=3;
  1750. $17=self._collection();
  1751. $ctx1.sendIdx["collection"]=5;
  1752. $18=self._sampleNewValueAsCollection();
  1753. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1754. $16=_st($17).__comma($18);
  1755. $ctx1.sendIdx[","]=4;
  1756. $19=self._collectionWithNewValue();
  1757. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1758. self._assert_equals_($16,$19);
  1759. self._assertSameContents_as_(_st(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  1760. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.CollectionTest)})},
  1761. args: [],
  1762. source: "testComma\x0a\x09self assert: self collection, self collectionClass new equals: self collection.\x0a\x09self assert: self collectionClass new, self collection equals: self collection.\x0a\x09self assert: self collectionClass new, self collectionClass new equals: self collectionClass new.\x0a\x09self assert: self collection, self sampleNewValueAsCollection equals: self collectionWithNewValue.\x0a\x09self assertSameContents: self sampleNewValueAsCollection, self collection as: self collectionWithNewValue",
  1763. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1764. referencedClasses: []
  1765. }),
  1766. globals.CollectionTest);
  1767. smalltalk.addMethod(
  1768. smalltalk.method({
  1769. selector: "testDetect",
  1770. protocol: 'tests',
  1771. fn: function (){
  1772. var self=this;
  1773. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  1774. return smalltalk.withContext(function($ctx1) {
  1775. var $1,$2,$3,$4,$6,$5,$7;
  1776. self._shouldnt_raise_((function(){
  1777. return smalltalk.withContext(function($ctx2) {
  1778. $1=self._collection();
  1779. $ctx2.sendIdx["collection"]=1;
  1780. return _st($1)._detect_((function(){
  1781. return true;
  1782. }));
  1783. $ctx2.sendIdx["detect:"]=1;
  1784. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1785. self._should_raise_((function(){
  1786. return smalltalk.withContext(function($ctx2) {
  1787. $2=self._collection();
  1788. $ctx2.sendIdx["collection"]=2;
  1789. return _st($2)._detect_((function(){
  1790. return false;
  1791. }));
  1792. $ctx2.sendIdx["detect:"]=2;
  1793. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$Error());
  1794. $ctx1.sendIdx["should:raise:"]=1;
  1795. $3=_st(self._sampleNewValueAsCollection())._detect_((function(){
  1796. return true;
  1797. }));
  1798. $ctx1.sendIdx["detect:"]=3;
  1799. $4=self._sampleNewValue();
  1800. $ctx1.sendIdx["sampleNewValue"]=1;
  1801. self._assert_equals_($3,$4);
  1802. $ctx1.sendIdx["assert:equals:"]=1;
  1803. $5=_st(self._collectionWithNewValue())._detect_((function(each){
  1804. return smalltalk.withContext(function($ctx2) {
  1805. $6=self._sampleNewValue();
  1806. $ctx2.sendIdx["sampleNewValue"]=2;
  1807. return _st(each).__eq($6);
  1808. $ctx2.sendIdx["="]=1;
  1809. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})}));
  1810. $ctx1.sendIdx["detect:"]=4;
  1811. $7=self._sampleNewValue();
  1812. $ctx1.sendIdx["sampleNewValue"]=3;
  1813. self._assert_equals_($5,$7);
  1814. self._should_raise_((function(){
  1815. return smalltalk.withContext(function($ctx2) {
  1816. return _st(self._collection())._detect_((function(each){
  1817. return smalltalk.withContext(function($ctx3) {
  1818. return _st(each).__eq(self._sampleNewValue());
  1819. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)})}));
  1820. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$Error());
  1821. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},globals.CollectionTest)})},
  1822. args: [],
  1823. source: "testDetect\x0a\x09self\x0a\x09\x09shouldnt: [ self collection detect: [ true ] ]\x0a\x09\x09raise: Error.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ false ] ]\x0a\x09\x09raise: Error.\x0a\x09self assert: (self sampleNewValueAsCollection detect: [ true ]) equals: self sampleNewValue.\x0a\x09self assert: (self collectionWithNewValue detect: [ :each | each = self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ :each | each = self sampleNewValue ] ]\x0a\x09\x09raise: Error",
  1824. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1825. referencedClasses: ["Error"]
  1826. }),
  1827. globals.CollectionTest);
  1828. smalltalk.addMethod(
  1829. smalltalk.method({
  1830. selector: "testDetectIfNone",
  1831. protocol: 'tests',
  1832. fn: function (){
  1833. var self=this;
  1834. var sentinel;
  1835. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  1836. return smalltalk.withContext(function($ctx1) {
  1837. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  1838. sentinel=_st($Object())._new();
  1839. $3=self._collection();
  1840. $ctx1.sendIdx["collection"]=1;
  1841. $2=_st($3)._detect_ifNone_((function(){
  1842. return true;
  1843. }),(function(){
  1844. return sentinel;
  1845. }));
  1846. $ctx1.sendIdx["detect:ifNone:"]=1;
  1847. $1=_st($2).__tild_eq(sentinel);
  1848. self._assert_($1);
  1849. $5=self._collection();
  1850. $ctx1.sendIdx["collection"]=2;
  1851. $4=_st($5)._detect_ifNone_((function(){
  1852. return false;
  1853. }),(function(){
  1854. return sentinel;
  1855. }));
  1856. $ctx1.sendIdx["detect:ifNone:"]=2;
  1857. self._assert_equals_($4,sentinel);
  1858. $ctx1.sendIdx["assert:equals:"]=1;
  1859. $6=_st(self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  1860. return true;
  1861. }),(function(){
  1862. return sentinel;
  1863. }));
  1864. $ctx1.sendIdx["detect:ifNone:"]=3;
  1865. $7=self._sampleNewValue();
  1866. $ctx1.sendIdx["sampleNewValue"]=1;
  1867. self._assert_equals_($6,$7);
  1868. $ctx1.sendIdx["assert:equals:"]=2;
  1869. $8=_st(self._collectionWithNewValue())._detect_ifNone_((function(each){
  1870. return smalltalk.withContext(function($ctx2) {
  1871. $9=self._sampleNewValue();
  1872. $ctx2.sendIdx["sampleNewValue"]=2;
  1873. return _st(each).__eq($9);
  1874. $ctx2.sendIdx["="]=1;
  1875. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)})}),(function(){
  1876. return sentinel;
  1877. }));
  1878. $ctx1.sendIdx["detect:ifNone:"]=4;
  1879. $10=self._sampleNewValue();
  1880. $ctx1.sendIdx["sampleNewValue"]=3;
  1881. self._assert_equals_($8,$10);
  1882. $ctx1.sendIdx["assert:equals:"]=3;
  1883. self._assert_equals_(_st(self._collection())._detect_ifNone_((function(each){
  1884. return smalltalk.withContext(function($ctx2) {
  1885. return _st(each).__eq(self._sampleNewValue());
  1886. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)})}),(function(){
  1887. return sentinel;
  1888. })),sentinel);
  1889. return self}, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},globals.CollectionTest)})},
  1890. args: [],
  1891. source: "testDetectIfNone\x0a\x09| sentinel |\x0a\x09sentinel := Object new.\x0a\x09self assert: (self collection detect: [ true ] ifNone: [ sentinel ]) ~= sentinel.\x0a\x09self assert: (self collection detect: [ false ] ifNone: [ sentinel ]) equals: sentinel.\x0a\x09self assert: (self sampleNewValueAsCollection detect: [ true ] ifNone: [ sentinel ]) equals: self sampleNewValue.\x0a\x09self assert: (self collectionWithNewValue detect: [ :each | each = self sampleNewValue ] ifNone: [ sentinel ]) equals: self sampleNewValue.\x0a\x09self assert: (self collection detect: [ :each | each = self sampleNewValue ] ifNone: [ sentinel ]) equals: sentinel",
  1892. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="],
  1893. referencedClasses: ["Object"]
  1894. }),
  1895. globals.CollectionTest);
  1896. smalltalk.addMethod(
  1897. smalltalk.method({
  1898. selector: "testDo",
  1899. protocol: 'tests',
  1900. fn: function (){
  1901. var self=this;
  1902. var newCollection;
  1903. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1904. return smalltalk.withContext(function($ctx1) {
  1905. var $1,$2;
  1906. newCollection=_st($OrderedCollection())._new();
  1907. $ctx1.sendIdx["new"]=1;
  1908. $1=self._collection();
  1909. $ctx1.sendIdx["collection"]=1;
  1910. _st($1)._do_((function(each){
  1911. return smalltalk.withContext(function($ctx2) {
  1912. return _st(newCollection)._add_(each);
  1913. $ctx2.sendIdx["add:"]=1;
  1914. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1915. $ctx1.sendIdx["do:"]=1;
  1916. self._assertSameContents_as_(self._collection(),newCollection);
  1917. $ctx1.sendIdx["assertSameContents:as:"]=1;
  1918. newCollection=_st($OrderedCollection())._new();
  1919. $2=self._collectionWithDuplicates();
  1920. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  1921. _st($2)._do_((function(each){
  1922. return smalltalk.withContext(function($ctx2) {
  1923. return _st(newCollection)._add_(each);
  1924. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1925. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  1926. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},globals.CollectionTest)})},
  1927. args: [],
  1928. source: "testDo\x0a\x09| newCollection |\x0a\x09newCollection := OrderedCollection new.\x0a\x09self collection do: [ :each |\x0a\x09\x09newCollection add: each ].\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: newCollection.\x0a\x09newCollection := OrderedCollection new.\x0a\x09self collectionWithDuplicates do: [ :each |\x0a\x09\x09newCollection add: each ].\x0a\x09self\x0a\x09\x09assertSameContents: self collectionWithDuplicates\x0a\x09\x09as: newCollection",
  1929. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"],
  1930. referencedClasses: ["OrderedCollection"]
  1931. }),
  1932. globals.CollectionTest);
  1933. smalltalk.addMethod(
  1934. smalltalk.method({
  1935. selector: "testIfEmptyFamily",
  1936. protocol: 'tests',
  1937. fn: function (){
  1938. var self=this;
  1939. return smalltalk.withContext(function($ctx1) {
  1940. var $3,$2,$1,$5,$4,$6,$9,$8,$7,$11,$10,$13,$12,$16,$15,$14,$18,$17,$19;
  1941. $3=self._collectionClass();
  1942. $ctx1.sendIdx["collectionClass"]=1;
  1943. $2=_st($3)._new();
  1944. $ctx1.sendIdx["new"]=1;
  1945. $1=_st($2)._ifEmpty_((function(){
  1946. return (42);
  1947. }));
  1948. $ctx1.sendIdx["ifEmpty:"]=1;
  1949. self._assert_equals_($1,(42));
  1950. $ctx1.sendIdx["assert:equals:"]=1;
  1951. $5=self._collection();
  1952. $ctx1.sendIdx["collection"]=1;
  1953. $4=_st($5)._ifEmpty_((function(){
  1954. return (42);
  1955. }));
  1956. $6=self._collection();
  1957. $ctx1.sendIdx["collection"]=2;
  1958. self._assert_equals_($4,$6);
  1959. $ctx1.sendIdx["assert:equals:"]=2;
  1960. $9=self._collectionClass();
  1961. $ctx1.sendIdx["collectionClass"]=2;
  1962. $8=_st($9)._new();
  1963. $ctx1.sendIdx["new"]=2;
  1964. $7=_st($8)._ifNotEmpty_((function(){
  1965. return (42);
  1966. }));
  1967. $ctx1.sendIdx["ifNotEmpty:"]=1;
  1968. $11=self._collectionClass();
  1969. $ctx1.sendIdx["collectionClass"]=3;
  1970. $10=_st($11)._new();
  1971. $ctx1.sendIdx["new"]=3;
  1972. self._assert_equals_($7,$10);
  1973. $ctx1.sendIdx["assert:equals:"]=3;
  1974. $13=self._collection();
  1975. $ctx1.sendIdx["collection"]=3;
  1976. $12=_st($13)._ifNotEmpty_((function(){
  1977. return (42);
  1978. }));
  1979. self._assert_equals_($12,(42));
  1980. $ctx1.sendIdx["assert:equals:"]=4;
  1981. $16=self._collectionClass();
  1982. $ctx1.sendIdx["collectionClass"]=4;
  1983. $15=_st($16)._new();
  1984. $ctx1.sendIdx["new"]=4;
  1985. $14=_st($15)._ifEmpty_ifNotEmpty_((function(){
  1986. return (42);
  1987. }),(function(){
  1988. return (999);
  1989. }));
  1990. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  1991. self._assert_equals_($14,(42));
  1992. $ctx1.sendIdx["assert:equals:"]=5;
  1993. $18=self._collection();
  1994. $ctx1.sendIdx["collection"]=4;
  1995. $17=_st($18)._ifEmpty_ifNotEmpty_((function(){
  1996. return (42);
  1997. }),(function(){
  1998. return (999);
  1999. }));
  2000. self._assert_equals_($17,(999));
  2001. $ctx1.sendIdx["assert:equals:"]=6;
  2002. $19=_st(_st(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  2003. return (42);
  2004. }),(function(){
  2005. return (999);
  2006. }));
  2007. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  2008. self._assert_equals_($19,(999));
  2009. $ctx1.sendIdx["assert:equals:"]=7;
  2010. self._assert_equals_(_st(self._collection())._ifNotEmpty_ifEmpty_((function(){
  2011. return (42);
  2012. }),(function(){
  2013. return (999);
  2014. })),(42));
  2015. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},globals.CollectionTest)})},
  2016. args: [],
  2017. 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",
  2018. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"],
  2019. referencedClasses: []
  2020. }),
  2021. globals.CollectionTest);
  2022. smalltalk.addMethod(
  2023. smalltalk.method({
  2024. selector: "testIsEmpty",
  2025. protocol: 'tests',
  2026. fn: function (){
  2027. var self=this;
  2028. return smalltalk.withContext(function($ctx1) {
  2029. var $1;
  2030. $1=_st(_st(self._collectionClass())._new())._isEmpty();
  2031. $ctx1.sendIdx["isEmpty"]=1;
  2032. self._assert_($1);
  2033. self._deny_(_st(self._collection())._isEmpty());
  2034. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},globals.CollectionTest)})},
  2035. args: [],
  2036. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  2037. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  2038. referencedClasses: []
  2039. }),
  2040. globals.CollectionTest);
  2041. smalltalk.addMethod(
  2042. smalltalk.method({
  2043. selector: "testNoneSatisfy",
  2044. protocol: 'tests',
  2045. fn: function (){
  2046. var self=this;
  2047. var anyOne;
  2048. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  2049. return smalltalk.withContext(function($ctx1) {
  2050. var $1,$3,$2;
  2051. $1=self._collection();
  2052. $ctx1.sendIdx["collection"]=1;
  2053. anyOne=_st($1)._anyOne();
  2054. $3=self._collection();
  2055. $ctx1.sendIdx["collection"]=2;
  2056. $2=_st($3)._noneSatisfy_((function(each){
  2057. return smalltalk.withContext(function($ctx2) {
  2058. return _st(each).__eq(anyOne);
  2059. $ctx2.sendIdx["="]=1;
  2060. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2061. $ctx1.sendIdx["noneSatisfy:"]=1;
  2062. self._deny_($2);
  2063. self._assert_(_st(self._collection())._noneSatisfy_((function(each){
  2064. return smalltalk.withContext(function($ctx2) {
  2065. return _st(each).__eq(_st($Object())._new());
  2066. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  2067. return self}, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},globals.CollectionTest)})},
  2068. args: [],
  2069. 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 ])",
  2070. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"],
  2071. referencedClasses: ["Object"]
  2072. }),
  2073. globals.CollectionTest);
  2074. smalltalk.addMethod(
  2075. smalltalk.method({
  2076. selector: "testRemoveAll",
  2077. protocol: 'tests',
  2078. fn: function (){
  2079. var self=this;
  2080. return smalltalk.withContext(function($ctx1) {
  2081. var $1,$2;
  2082. $1=self._collection();
  2083. _st($1)._removeAll();
  2084. $2=_st($1)._yourself();
  2085. self._assert_equals_($2,_st(self._collectionClass())._new());
  2086. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},globals.CollectionTest)})},
  2087. args: [],
  2088. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  2089. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"],
  2090. referencedClasses: []
  2091. }),
  2092. globals.CollectionTest);
  2093. smalltalk.addMethod(
  2094. smalltalk.method({
  2095. selector: "testSelect",
  2096. protocol: 'tests',
  2097. fn: function (){
  2098. var self=this;
  2099. return smalltalk.withContext(function($ctx1) {
  2100. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  2101. $2=self._collection();
  2102. $ctx1.sendIdx["collection"]=1;
  2103. $1=_st($2)._select_((function(){
  2104. return false;
  2105. }));
  2106. $ctx1.sendIdx["select:"]=1;
  2107. $4=self._collectionClass();
  2108. $ctx1.sendIdx["collectionClass"]=1;
  2109. $3=_st($4)._new();
  2110. $ctx1.sendIdx["new"]=1;
  2111. self._assert_equals_($1,$3);
  2112. $ctx1.sendIdx["assert:equals:"]=1;
  2113. $6=self._collection();
  2114. $ctx1.sendIdx["collection"]=2;
  2115. $5=_st($6)._select_((function(){
  2116. return true;
  2117. }));
  2118. $ctx1.sendIdx["select:"]=2;
  2119. $7=self._collection();
  2120. $ctx1.sendIdx["collection"]=3;
  2121. self._assert_equals_($5,$7);
  2122. $ctx1.sendIdx["assert:equals:"]=2;
  2123. $9=self._collectionWithNewValue();
  2124. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2125. $8=_st($9)._select_((function(each){
  2126. return smalltalk.withContext(function($ctx2) {
  2127. $10=self._sampleNewValue();
  2128. $ctx2.sendIdx["sampleNewValue"]=1;
  2129. return _st(each).__eq($10);
  2130. $ctx2.sendIdx["="]=1;
  2131. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  2132. $ctx1.sendIdx["select:"]=3;
  2133. self._assert_equals_($8,self._sampleNewValueAsCollection());
  2134. $ctx1.sendIdx["assert:equals:"]=3;
  2135. $12=self._collectionWithNewValue();
  2136. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2137. $11=_st($12)._select_((function(each){
  2138. return smalltalk.withContext(function($ctx2) {
  2139. $13=self._sampleNewValue();
  2140. $ctx2.sendIdx["sampleNewValue"]=2;
  2141. return _st(each).__tild_eq($13);
  2142. $ctx2.sendIdx["~="]=1;
  2143. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)})}));
  2144. $ctx1.sendIdx["select:"]=4;
  2145. $14=self._collection();
  2146. $ctx1.sendIdx["collection"]=4;
  2147. self._assert_equals_($11,$14);
  2148. $ctx1.sendIdx["assert:equals:"]=4;
  2149. $16=self._collection();
  2150. $ctx1.sendIdx["collection"]=5;
  2151. $15=_st($16)._select_((function(each){
  2152. return smalltalk.withContext(function($ctx2) {
  2153. $17=self._sampleNewValue();
  2154. $ctx2.sendIdx["sampleNewValue"]=3;
  2155. return _st(each).__eq($17);
  2156. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)})}));
  2157. $ctx1.sendIdx["select:"]=5;
  2158. self._assert_equals_($15,_st(self._collectionClass())._new());
  2159. $ctx1.sendIdx["assert:equals:"]=5;
  2160. self._assert_equals_(_st(self._collectionWithNewValue())._select_((function(each){
  2161. return smalltalk.withContext(function($ctx2) {
  2162. return _st(each).__tild_eq(self._sampleNewValue());
  2163. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)})})),self._collection());
  2164. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{},globals.CollectionTest)})},
  2165. args: [],
  2166. 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",
  2167. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="],
  2168. referencedClasses: []
  2169. }),
  2170. globals.CollectionTest);
  2171. smalltalk.addMethod(
  2172. smalltalk.method({
  2173. selector: "testSize",
  2174. protocol: 'tests',
  2175. fn: function (){
  2176. var self=this;
  2177. return smalltalk.withContext(function($ctx1) {
  2178. var $1,$2;
  2179. $1=_st(_st(self._collectionClass())._new())._size();
  2180. $ctx1.sendIdx["size"]=1;
  2181. self._assert_equals_($1,(0));
  2182. $ctx1.sendIdx["assert:equals:"]=1;
  2183. $2=_st(self._sampleNewValueAsCollection())._size();
  2184. $ctx1.sendIdx["size"]=2;
  2185. self._assert_equals_($2,(1));
  2186. $ctx1.sendIdx["assert:equals:"]=2;
  2187. self._assert_equals_(_st(self._collection())._size(),self._collectionSize());
  2188. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},globals.CollectionTest)})},
  2189. args: [],
  2190. 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",
  2191. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"],
  2192. referencedClasses: []
  2193. }),
  2194. globals.CollectionTest);
  2195. smalltalk.addMethod(
  2196. smalltalk.method({
  2197. selector: "collectionClass",
  2198. protocol: 'fixture',
  2199. fn: function (){
  2200. var self=this;
  2201. return nil;
  2202. },
  2203. args: [],
  2204. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  2205. messageSends: [],
  2206. referencedClasses: []
  2207. }),
  2208. globals.CollectionTest.klass);
  2209. smalltalk.addMethod(
  2210. smalltalk.method({
  2211. selector: "isAbstract",
  2212. protocol: 'testing',
  2213. fn: function (){
  2214. var self=this;
  2215. return smalltalk.withContext(function($ctx1) {
  2216. var $1;
  2217. $1=_st(self._collectionClass())._isNil();
  2218. return $1;
  2219. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},globals.CollectionTest.klass)})},
  2220. args: [],
  2221. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  2222. messageSends: ["isNil", "collectionClass"],
  2223. referencedClasses: []
  2224. }),
  2225. globals.CollectionTest.klass);
  2226. smalltalk.addClass('IndexableCollectionTest', globals.CollectionTest, [], 'Kernel-Tests');
  2227. smalltalk.addMethod(
  2228. smalltalk.method({
  2229. selector: "collectionWithNewValue",
  2230. protocol: 'fixture',
  2231. fn: function (){
  2232. var self=this;
  2233. return smalltalk.withContext(function($ctx1) {
  2234. self._subclassResponsibility();
  2235. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.IndexableCollectionTest)})},
  2236. args: [],
  2237. 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",
  2238. messageSends: ["subclassResponsibility"],
  2239. referencedClasses: []
  2240. }),
  2241. globals.IndexableCollectionTest);
  2242. smalltalk.addMethod(
  2243. smalltalk.method({
  2244. selector: "sampleNewIndex",
  2245. protocol: 'fixture',
  2246. fn: function (){
  2247. var self=this;
  2248. return smalltalk.withContext(function($ctx1) {
  2249. self._subclassResponsibility();
  2250. return self}, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},globals.IndexableCollectionTest)})},
  2251. args: [],
  2252. 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",
  2253. messageSends: ["subclassResponsibility"],
  2254. referencedClasses: []
  2255. }),
  2256. globals.IndexableCollectionTest);
  2257. smalltalk.addMethod(
  2258. smalltalk.method({
  2259. selector: "sampleNonIndexesDo:",
  2260. protocol: 'fixture',
  2261. fn: function (aBlock){
  2262. var self=this;
  2263. return smalltalk.withContext(function($ctx1) {
  2264. self._subclassResponsibility();
  2265. return self}, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},globals.IndexableCollectionTest)})},
  2266. args: ["aBlock"],
  2267. 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",
  2268. messageSends: ["subclassResponsibility"],
  2269. referencedClasses: []
  2270. }),
  2271. globals.IndexableCollectionTest);
  2272. smalltalk.addMethod(
  2273. smalltalk.method({
  2274. selector: "samplesDo:",
  2275. protocol: 'fixture',
  2276. fn: function (aBlock){
  2277. var self=this;
  2278. return smalltalk.withContext(function($ctx1) {
  2279. self._subclassResponsibility();
  2280. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.IndexableCollectionTest)})},
  2281. args: ["aBlock"],
  2282. 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",
  2283. messageSends: ["subclassResponsibility"],
  2284. referencedClasses: []
  2285. }),
  2286. globals.IndexableCollectionTest);
  2287. smalltalk.addMethod(
  2288. smalltalk.method({
  2289. selector: "testAt",
  2290. protocol: 'tests',
  2291. fn: function (){
  2292. var self=this;
  2293. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2294. return smalltalk.withContext(function($ctx1) {
  2295. var $1;
  2296. self._nonIndexesDo_((function(each){
  2297. return smalltalk.withContext(function($ctx2) {
  2298. return self._should_raise_((function(){
  2299. return smalltalk.withContext(function($ctx3) {
  2300. $1=self._collection();
  2301. $ctx3.sendIdx["collection"]=1;
  2302. return _st($1)._at_(each);
  2303. $ctx3.sendIdx["at:"]=1;
  2304. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2305. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2306. self._samplesDo_((function(index,value){
  2307. return smalltalk.withContext(function($ctx2) {
  2308. return self._assert_equals_(_st(self._collection())._at_(index),value);
  2309. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2310. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.IndexableCollectionTest)})},
  2311. args: [],
  2312. 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 ]",
  2313. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"],
  2314. referencedClasses: ["Error"]
  2315. }),
  2316. globals.IndexableCollectionTest);
  2317. smalltalk.addMethod(
  2318. smalltalk.method({
  2319. selector: "testAtIfAbsent",
  2320. protocol: 'tests',
  2321. fn: function (){
  2322. var self=this;
  2323. return smalltalk.withContext(function($ctx1) {
  2324. var $2,$1,$3;
  2325. self._nonIndexesDo_((function(each){
  2326. return smalltalk.withContext(function($ctx2) {
  2327. $2=self._collection();
  2328. $ctx2.sendIdx["collection"]=1;
  2329. $1=_st($2)._at_ifAbsent_(each,(function(){
  2330. return smalltalk.withContext(function($ctx3) {
  2331. return self._sampleNewValue();
  2332. $ctx3.sendIdx["sampleNewValue"]=1;
  2333. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2334. $ctx2.sendIdx["at:ifAbsent:"]=1;
  2335. $3=self._sampleNewValue();
  2336. $ctx2.sendIdx["sampleNewValue"]=2;
  2337. return self._assert_equals_($1,$3);
  2338. $ctx2.sendIdx["assert:equals:"]=1;
  2339. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2340. self._samplesDo_((function(index,value){
  2341. return smalltalk.withContext(function($ctx2) {
  2342. return self._assert_equals_(_st(self._collection())._at_ifAbsent_(index,(function(){
  2343. return smalltalk.withContext(function($ctx3) {
  2344. return self._sampleNewValue();
  2345. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})})),value);
  2346. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2347. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},globals.IndexableCollectionTest)})},
  2348. args: [],
  2349. 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 ].",
  2350. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"],
  2351. referencedClasses: []
  2352. }),
  2353. globals.IndexableCollectionTest);
  2354. smalltalk.addMethod(
  2355. smalltalk.method({
  2356. selector: "testAtIfAbsentPut",
  2357. protocol: 'tests',
  2358. fn: function (){
  2359. var self=this;
  2360. var newCollection;
  2361. return smalltalk.withContext(function($ctx1) {
  2362. var $1;
  2363. newCollection=self._collection();
  2364. $ctx1.sendIdx["collection"]=1;
  2365. self._samplesDo_((function(index,value){
  2366. return smalltalk.withContext(function($ctx2) {
  2367. $1=_st(newCollection)._at_ifAbsentPut_(index,(function(){
  2368. return smalltalk.withContext(function($ctx3) {
  2369. return self._sampleNewValue();
  2370. $ctx3.sendIdx["sampleNewValue"]=1;
  2371. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2372. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  2373. return self._assert_equals_($1,value);
  2374. $ctx2.sendIdx["assert:equals:"]=1;
  2375. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2376. self._assert_equals_(newCollection,self._collection());
  2377. $ctx1.sendIdx["assert:equals:"]=2;
  2378. self._assert_equals_(_st(newCollection)._at_ifAbsentPut_(self._sampleNewIndex(),(function(){
  2379. return smalltalk.withContext(function($ctx2) {
  2380. return self._sampleNewValue();
  2381. $ctx2.sendIdx["sampleNewValue"]=2;
  2382. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})})),self._sampleNewValue());
  2383. $ctx1.sendIdx["assert:equals:"]=3;
  2384. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2385. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},globals.IndexableCollectionTest)})},
  2386. args: [],
  2387. source: "testAtIfAbsentPut\x0a\x09| newCollection |\x0a\x09newCollection := self collection.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (newCollection at: index ifAbsentPut: [ self sampleNewValue ]) equals: value ].\x0a\x09self assert: newCollection equals: self collection.\x0a\x09self assert: (newCollection at: self sampleNewIndex ifAbsentPut: [ self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09self assert: newCollection equals: self collectionWithNewValue",
  2388. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"],
  2389. referencedClasses: []
  2390. }),
  2391. globals.IndexableCollectionTest);
  2392. smalltalk.addMethod(
  2393. smalltalk.method({
  2394. selector: "testAtIfPresent",
  2395. protocol: 'tests',
  2396. fn: function (){
  2397. var self=this;
  2398. var visited,sentinel;
  2399. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  2400. return smalltalk.withContext(function($ctx1) {
  2401. var $2,$1,$4,$3;
  2402. sentinel=_st($Object())._new();
  2403. self._nonIndexesDo_((function(each){
  2404. return smalltalk.withContext(function($ctx2) {
  2405. visited=nil;
  2406. visited;
  2407. $2=self._collection();
  2408. $ctx2.sendIdx["collection"]=1;
  2409. $1=_st($2)._at_ifPresent_(each,(function(value1){
  2410. visited=value1;
  2411. visited;
  2412. return sentinel;
  2413. }));
  2414. $ctx2.sendIdx["at:ifPresent:"]=1;
  2415. self._assert_equals_($1,nil);
  2416. $ctx2.sendIdx["assert:equals:"]=1;
  2417. return self._assert_(_st(visited)._isNil());
  2418. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2419. self._samplesDo_((function(index,value){
  2420. return smalltalk.withContext(function($ctx2) {
  2421. visited=nil;
  2422. visited;
  2423. $4=self._collection();
  2424. $ctx2.sendIdx["collection"]=2;
  2425. $3=_st($4)._at_ifPresent_(index,(function(value2){
  2426. visited=value2;
  2427. visited;
  2428. return sentinel;
  2429. }));
  2430. self._assert_equals_($3,sentinel);
  2431. $ctx2.sendIdx["assert:equals:"]=2;
  2432. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2433. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2434. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},globals.IndexableCollectionTest)})},
  2435. args: [],
  2436. 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) ]",
  2437. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"],
  2438. referencedClasses: ["Object"]
  2439. }),
  2440. globals.IndexableCollectionTest);
  2441. smalltalk.addMethod(
  2442. smalltalk.method({
  2443. selector: "testAtIfPresentIfAbsent",
  2444. protocol: 'tests',
  2445. fn: function (){
  2446. var self=this;
  2447. var visited,sentinel;
  2448. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  2449. return smalltalk.withContext(function($ctx1) {
  2450. var $2,$1,$3,$5,$4;
  2451. sentinel=_st($Object())._new();
  2452. self._nonIndexesDo_((function(each){
  2453. return smalltalk.withContext(function($ctx2) {
  2454. visited=nil;
  2455. visited;
  2456. $2=self._collection();
  2457. $ctx2.sendIdx["collection"]=1;
  2458. $1=_st($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  2459. visited=value1;
  2460. visited;
  2461. return sentinel;
  2462. }),(function(){
  2463. return smalltalk.withContext(function($ctx3) {
  2464. return self._sampleNewValue();
  2465. $ctx3.sendIdx["sampleNewValue"]=1;
  2466. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  2467. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  2468. $3=self._sampleNewValue();
  2469. $ctx2.sendIdx["sampleNewValue"]=2;
  2470. self._assert_equals_($1,$3);
  2471. $ctx2.sendIdx["assert:equals:"]=1;
  2472. return self._assert_(_st(visited)._isNil());
  2473. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2474. self._samplesDo_((function(index,value){
  2475. return smalltalk.withContext(function($ctx2) {
  2476. visited=nil;
  2477. visited;
  2478. $5=self._collection();
  2479. $ctx2.sendIdx["collection"]=2;
  2480. $4=_st($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  2481. visited=value2;
  2482. visited;
  2483. return sentinel;
  2484. }),(function(){
  2485. return smalltalk.withContext(function($ctx3) {
  2486. return self._sampleNewValue();
  2487. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)})}));
  2488. self._assert_equals_($4,sentinel);
  2489. $ctx2.sendIdx["assert:equals:"]=2;
  2490. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2491. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)})}));
  2492. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},globals.IndexableCollectionTest)})},
  2493. args: [],
  2494. 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) ]",
  2495. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"],
  2496. referencedClasses: ["Object"]
  2497. }),
  2498. globals.IndexableCollectionTest);
  2499. smalltalk.addMethod(
  2500. smalltalk.method({
  2501. selector: "testAtPut",
  2502. protocol: 'tests',
  2503. fn: function (){
  2504. var self=this;
  2505. var newCollection;
  2506. return smalltalk.withContext(function($ctx1) {
  2507. newCollection=self._collection();
  2508. $ctx1.sendIdx["collection"]=1;
  2509. self._samplesDo_((function(index,value){
  2510. return smalltalk.withContext(function($ctx2) {
  2511. return _st(newCollection)._at_put_(index,value);
  2512. $ctx2.sendIdx["at:put:"]=1;
  2513. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2514. self._assert_equals_(newCollection,self._collection());
  2515. $ctx1.sendIdx["assert:equals:"]=1;
  2516. _st(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  2517. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2518. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},globals.IndexableCollectionTest)})},
  2519. args: [],
  2520. 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",
  2521. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"],
  2522. referencedClasses: []
  2523. }),
  2524. globals.IndexableCollectionTest);
  2525. smalltalk.addMethod(
  2526. smalltalk.method({
  2527. selector: "testEquality",
  2528. protocol: 'tests',
  2529. fn: function (){
  2530. var self=this;
  2531. return smalltalk.withContext(function($ctx1) {
  2532. var $2,$1,$4,$3,$5,$6,$7,$10,$9,$11,$8;
  2533. $2=self._collectionClass();
  2534. $ctx1.sendIdx["collectionClass"]=1;
  2535. $1=_st($2)._new();
  2536. $ctx1.sendIdx["new"]=1;
  2537. $4=self._collectionClass();
  2538. $ctx1.sendIdx["collectionClass"]=2;
  2539. $3=_st($4)._new();
  2540. $ctx1.sendIdx["new"]=2;
  2541. self._assert_equals_($1,$3);
  2542. $ctx1.sendIdx["assert:equals:"]=1;
  2543. $5=self._collection();
  2544. $ctx1.sendIdx["collection"]=1;
  2545. $6=self._collection();
  2546. $ctx1.sendIdx["collection"]=2;
  2547. self._assert_equals_($5,$6);
  2548. $ctx1.sendIdx["assert:equals:"]=2;
  2549. $7=self._collectionWithNewValue();
  2550. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2551. self._assert_equals_($7,self._collectionWithNewValue());
  2552. $10=self._collectionClass();
  2553. $ctx1.sendIdx["collectionClass"]=3;
  2554. $9=_st($10)._new();
  2555. $ctx1.sendIdx["new"]=3;
  2556. $11=self._collection();
  2557. $ctx1.sendIdx["collection"]=3;
  2558. $8=_st($9).__eq($11);
  2559. $ctx1.sendIdx["="]=1;
  2560. self._deny_($8);
  2561. $ctx1.sendIdx["deny:"]=1;
  2562. self._deny_(_st(self._collection()).__eq(_st(self._collectionClass())._new()));
  2563. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.IndexableCollectionTest)})},
  2564. args: [],
  2565. source: "testEquality\x0a\x09self assert: self collectionClass new equals: self collectionClass new.\x0a\x09self assert: self collection equals: self collection.\x0a\x09self assert: self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09\x0a\x09self deny: self collectionClass new = self collection.\x0a\x09self deny: self collection = self collectionClass new",
  2566. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="],
  2567. referencedClasses: []
  2568. }),
  2569. globals.IndexableCollectionTest);
  2570. smalltalk.addMethod(
  2571. smalltalk.method({
  2572. selector: "testIndexOf",
  2573. protocol: 'tests',
  2574. fn: function (){
  2575. var self=this;
  2576. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2577. return smalltalk.withContext(function($ctx1) {
  2578. var $1;
  2579. self._should_raise_((function(){
  2580. return smalltalk.withContext(function($ctx2) {
  2581. $1=self._collection();
  2582. $ctx2.sendIdx["collection"]=1;
  2583. return _st($1)._indexOf_(self._sampleNewValue());
  2584. $ctx2.sendIdx["indexOf:"]=1;
  2585. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2586. self._samplesDo_((function(index,value){
  2587. return smalltalk.withContext(function($ctx2) {
  2588. return self._assert_equals_(_st(self._collection())._indexOf_(value),index);
  2589. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)})}));
  2590. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},globals.IndexableCollectionTest)})},
  2591. args: [],
  2592. 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 ]",
  2593. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"],
  2594. referencedClasses: ["Error"]
  2595. }),
  2596. globals.IndexableCollectionTest);
  2597. smalltalk.addMethod(
  2598. smalltalk.method({
  2599. selector: "testIndexOfWithNull",
  2600. protocol: 'tests',
  2601. fn: function (){
  2602. var self=this;
  2603. var jsNull;
  2604. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  2605. return smalltalk.withContext(function($ctx1) {
  2606. var $1,$2;
  2607. jsNull=_st($JSON())._parse_("null");
  2608. self._samplesDo_((function(index,value){
  2609. return smalltalk.withContext(function($ctx2) {
  2610. $1=self._collection();
  2611. _st($1)._at_put_(index,jsNull);
  2612. $2=_st($1)._indexOf_(jsNull);
  2613. return self._assert_equals_($2,index);
  2614. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2615. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},globals.IndexableCollectionTest)})},
  2616. args: [],
  2617. source: "testIndexOfWithNull\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index put: jsNull; indexOf: jsNull) equals: index ]",
  2618. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"],
  2619. referencedClasses: ["JSON"]
  2620. }),
  2621. globals.IndexableCollectionTest);
  2622. smalltalk.addMethod(
  2623. smalltalk.method({
  2624. selector: "testWithIndexDo",
  2625. protocol: 'tests',
  2626. fn: function (){
  2627. var self=this;
  2628. var collection;
  2629. return smalltalk.withContext(function($ctx1) {
  2630. collection=self._collection();
  2631. $ctx1.sendIdx["collection"]=1;
  2632. _st(self._collection())._withIndexDo_((function(each,index){
  2633. return smalltalk.withContext(function($ctx2) {
  2634. return self._assert_equals_(_st(collection)._at_(index),each);
  2635. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  2636. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},globals.IndexableCollectionTest)})},
  2637. args: [],
  2638. 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 ]",
  2639. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  2640. referencedClasses: []
  2641. }),
  2642. globals.IndexableCollectionTest);
  2643. smalltalk.addClass('AssociativeCollectionTest', globals.IndexableCollectionTest, [], 'Kernel-Tests');
  2644. smalltalk.addMethod(
  2645. smalltalk.method({
  2646. selector: "collectionKeys",
  2647. protocol: 'fixture',
  2648. fn: function (){
  2649. var self=this;
  2650. return smalltalk.withContext(function($ctx1) {
  2651. self._subclassResponsibility();
  2652. return self}, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},globals.AssociativeCollectionTest)})},
  2653. args: [],
  2654. source: "collectionKeys\x0a\x09self subclassResponsibility",
  2655. messageSends: ["subclassResponsibility"],
  2656. referencedClasses: []
  2657. }),
  2658. globals.AssociativeCollectionTest);
  2659. smalltalk.addMethod(
  2660. smalltalk.method({
  2661. selector: "collectionValues",
  2662. protocol: 'fixture',
  2663. fn: function (){
  2664. var self=this;
  2665. return smalltalk.withContext(function($ctx1) {
  2666. self._subclassResponsibility();
  2667. return self}, function($ctx1) {$ctx1.fill(self,"collectionValues",{},globals.AssociativeCollectionTest)})},
  2668. args: [],
  2669. source: "collectionValues\x0a\x09self subclassResponsibility",
  2670. messageSends: ["subclassResponsibility"],
  2671. referencedClasses: []
  2672. }),
  2673. globals.AssociativeCollectionTest);
  2674. smalltalk.addMethod(
  2675. smalltalk.method({
  2676. selector: "nonIndexesDo:",
  2677. protocol: 'fixture',
  2678. fn: function (aBlock){
  2679. var self=this;
  2680. return smalltalk.withContext(function($ctx1) {
  2681. _st(aBlock)._value_((5));
  2682. $ctx1.sendIdx["value:"]=1;
  2683. _st(aBlock)._value_("z");
  2684. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},globals.AssociativeCollectionTest)})},
  2685. args: ["aBlock"],
  2686. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: 'z'",
  2687. messageSends: ["value:"],
  2688. referencedClasses: []
  2689. }),
  2690. globals.AssociativeCollectionTest);
  2691. smalltalk.addMethod(
  2692. smalltalk.method({
  2693. selector: "sampleNewIndex",
  2694. protocol: 'fixture',
  2695. fn: function (){
  2696. var self=this;
  2697. return "new";
  2698. },
  2699. args: [],
  2700. source: "sampleNewIndex\x0a\x09^ 'new'",
  2701. messageSends: [],
  2702. referencedClasses: []
  2703. }),
  2704. globals.AssociativeCollectionTest);
  2705. smalltalk.addMethod(
  2706. smalltalk.method({
  2707. selector: "samplesDo:",
  2708. protocol: 'fixture',
  2709. fn: function (aBlock){
  2710. var self=this;
  2711. return smalltalk.withContext(function($ctx1) {
  2712. _st(aBlock)._value_value_("a",(2));
  2713. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.AssociativeCollectionTest)})},
  2714. args: ["aBlock"],
  2715. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  2716. messageSends: ["value:value:"],
  2717. referencedClasses: []
  2718. }),
  2719. globals.AssociativeCollectionTest);
  2720. smalltalk.addMethod(
  2721. smalltalk.method({
  2722. selector: "testAddAll",
  2723. protocol: 'tests',
  2724. fn: function (){
  2725. var self=this;
  2726. return smalltalk.withContext(function($ctx1) {
  2727. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  2728. ($ctx1.supercall = true, globals.AssociativeCollectionTest.superclass.fn.prototype._testAddAll.apply(_st(self), []));
  2729. $ctx1.supercall = false;
  2730. $2=self._collection();
  2731. $ctx1.sendIdx["collection"]=1;
  2732. $3=$2;
  2733. $4=self._collection();
  2734. $ctx1.sendIdx["collection"]=2;
  2735. _st($3)._addAll_($4);
  2736. $ctx1.sendIdx["addAll:"]=1;
  2737. $5=_st($2)._yourself();
  2738. $ctx1.sendIdx["yourself"]=1;
  2739. $1=$5;
  2740. $6=self._collection();
  2741. $ctx1.sendIdx["collection"]=3;
  2742. self._assert_equals_($1,$6);
  2743. $ctx1.sendIdx["assert:equals:"]=1;
  2744. $8=self._collection();
  2745. $ctx1.sendIdx["collection"]=4;
  2746. $9=$8;
  2747. $10=self._collectionWithNewValue();
  2748. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2749. _st($9)._addAll_($10);
  2750. $ctx1.sendIdx["addAll:"]=2;
  2751. $11=_st($8)._yourself();
  2752. $ctx1.sendIdx["yourself"]=2;
  2753. $7=$11;
  2754. $12=self._collectionWithNewValue();
  2755. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2756. self._assert_equals_($7,$12);
  2757. $ctx1.sendIdx["assert:equals:"]=2;
  2758. $14=self._collectionWithNewValue();
  2759. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2760. _st($14)._addAll_(self._collection());
  2761. $15=_st($14)._yourself();
  2762. $13=$15;
  2763. self._assert_equals_($13,self._collectionWithNewValue());
  2764. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.AssociativeCollectionTest)})},
  2765. args: [],
  2766. 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",
  2767. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  2768. referencedClasses: []
  2769. }),
  2770. globals.AssociativeCollectionTest);
  2771. smalltalk.addMethod(
  2772. smalltalk.method({
  2773. selector: "testAsDictionary",
  2774. protocol: 'tests',
  2775. fn: function (){
  2776. var self=this;
  2777. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2778. return smalltalk.withContext(function($ctx1) {
  2779. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  2780. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},globals.AssociativeCollectionTest)})},
  2781. args: [],
  2782. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  2783. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  2784. referencedClasses: ["Dictionary"]
  2785. }),
  2786. globals.AssociativeCollectionTest);
  2787. smalltalk.addMethod(
  2788. smalltalk.method({
  2789. selector: "testAsHashedCollection",
  2790. protocol: 'tests',
  2791. fn: function (){
  2792. var self=this;
  2793. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2794. return smalltalk.withContext(function($ctx1) {
  2795. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  2796. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},globals.AssociativeCollectionTest)})},
  2797. args: [],
  2798. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  2799. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  2800. referencedClasses: ["HashedCollection"]
  2801. }),
  2802. globals.AssociativeCollectionTest);
  2803. smalltalk.addMethod(
  2804. smalltalk.method({
  2805. selector: "testComma",
  2806. protocol: 'tests',
  2807. fn: function (){
  2808. var self=this;
  2809. return smalltalk.withContext(function($ctx1) {
  2810. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  2811. ($ctx1.supercall = true, globals.AssociativeCollectionTest.superclass.fn.prototype._testComma.apply(_st(self), []));
  2812. $ctx1.supercall = false;
  2813. $2=self._collection();
  2814. $ctx1.sendIdx["collection"]=1;
  2815. $3=self._collection();
  2816. $ctx1.sendIdx["collection"]=2;
  2817. $1=_st($2).__comma($3);
  2818. $ctx1.sendIdx[","]=1;
  2819. $4=self._collection();
  2820. $ctx1.sendIdx["collection"]=3;
  2821. self._assert_equals_($1,$4);
  2822. $ctx1.sendIdx["assert:equals:"]=1;
  2823. $6=self._collection();
  2824. $ctx1.sendIdx["collection"]=4;
  2825. $7=self._collectionWithNewValue();
  2826. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2827. $5=_st($6).__comma($7);
  2828. $ctx1.sendIdx[","]=2;
  2829. $8=self._collectionWithNewValue();
  2830. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2831. self._assert_equals_($5,$8);
  2832. $ctx1.sendIdx["assert:equals:"]=2;
  2833. $10=self._collectionWithNewValue();
  2834. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2835. $9=_st($10).__comma(self._collection());
  2836. self._assert_equals_($9,self._collectionWithNewValue());
  2837. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.AssociativeCollectionTest)})},
  2838. args: [],
  2839. 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",
  2840. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  2841. referencedClasses: []
  2842. }),
  2843. globals.AssociativeCollectionTest);
  2844. smalltalk.addMethod(
  2845. smalltalk.method({
  2846. selector: "testFrom",
  2847. protocol: 'tests',
  2848. fn: function (){
  2849. var self=this;
  2850. var associations;
  2851. return smalltalk.withContext(function($ctx1) {
  2852. var $1;
  2853. $1="a".__minus_gt((1));
  2854. $ctx1.sendIdx["->"]=1;
  2855. associations=[$1,"b".__minus_gt((2))];
  2856. self._assertSameContents_as_(_st(_st(self._class())._collectionClass())._from_(associations),globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  2857. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},globals.AssociativeCollectionTest)})},
  2858. args: [],
  2859. 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 }.",
  2860. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  2861. referencedClasses: []
  2862. }),
  2863. globals.AssociativeCollectionTest);
  2864. smalltalk.addMethod(
  2865. smalltalk.method({
  2866. selector: "testKeys",
  2867. protocol: 'tests',
  2868. fn: function (){
  2869. var self=this;
  2870. return smalltalk.withContext(function($ctx1) {
  2871. var $2,$1,$3,$4;
  2872. $2=_st(_st(self._collectionClass())._new())._keys();
  2873. $ctx1.sendIdx["keys"]=1;
  2874. $1=_st($2)._isEmpty();
  2875. self._assert_($1);
  2876. $3=_st(self._collection())._keys();
  2877. $ctx1.sendIdx["keys"]=2;
  2878. $4=self._collectionKeys();
  2879. $ctx1.sendIdx["collectionKeys"]=1;
  2880. self._assertSameContents_as_($3,$4);
  2881. $ctx1.sendIdx["assertSameContents:as:"]=1;
  2882. self._assertSameContents_as_(_st(self._collectionWithNewValue())._keys(),_st(self._collectionKeys()).__comma([self._sampleNewIndex()]));
  2883. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{},globals.AssociativeCollectionTest)})},
  2884. args: [],
  2885. source: "testKeys\x0a\x09self assert:self collectionClass new keys isEmpty.\x0a\x09self assertSameContents:self collection keys as: self collectionKeys.\x0a\x09self assertSameContents:self collectionWithNewValue keys as: self collectionKeys, { self sampleNewIndex }",
  2886. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"],
  2887. referencedClasses: []
  2888. }),
  2889. globals.AssociativeCollectionTest);
  2890. smalltalk.addMethod(
  2891. smalltalk.method({
  2892. selector: "testNewFromPairs",
  2893. protocol: 'tests',
  2894. fn: function (){
  2895. var self=this;
  2896. var flattenedAssociations;
  2897. return smalltalk.withContext(function($ctx1) {
  2898. flattenedAssociations=["a",(1),"b",(2)];
  2899. self._assertSameContents_as_(_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations),globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  2900. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},globals.AssociativeCollectionTest)})},
  2901. args: [],
  2902. 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 }.",
  2903. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"],
  2904. referencedClasses: []
  2905. }),
  2906. globals.AssociativeCollectionTest);
  2907. smalltalk.addMethod(
  2908. smalltalk.method({
  2909. selector: "testPrintString",
  2910. protocol: 'tests',
  2911. fn: function (){
  2912. var self=this;
  2913. return smalltalk.withContext(function($ctx1) {
  2914. var $3,$2,$4,$1,$5;
  2915. $3=self._collectionClass();
  2916. $ctx1.sendIdx["collectionClass"]=1;
  2917. $2=_st($3)._new();
  2918. _st($2)._at_put_("firstname","James");
  2919. $ctx1.sendIdx["at:put:"]=1;
  2920. _st($2)._at_put_("lastname","Bond");
  2921. $4=_st($2)._printString();
  2922. $1=$4;
  2923. $5=_st("a ".__comma(_st(self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  2924. $ctx1.sendIdx[","]=1;
  2925. self._assert_equals_($1,$5);
  2926. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},globals.AssociativeCollectionTest)})},
  2927. args: [],
  2928. source: "testPrintString\x0a\x09self\x0a\x09\x09assert: (self collectionClass new\x0a\x09\x09\x09\x09\x09\x09\x09at:'firstname' put: 'James';\x0a\x09\x09\x09\x09\x09\x09\x09at:'lastname' put: 'Bond';\x0a\x09\x09\x09\x09\x09\x09\x09printString)\x0a\x09\x09equals: 'a ', self collectionClass name, ' (''firstname'' -> ''James'' , ''lastname'' -> ''Bond'')'",
  2929. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"],
  2930. referencedClasses: []
  2931. }),
  2932. globals.AssociativeCollectionTest);
  2933. smalltalk.addMethod(
  2934. smalltalk.method({
  2935. selector: "testRemoveKey",
  2936. protocol: 'tests',
  2937. fn: function (){
  2938. var self=this;
  2939. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  2940. return smalltalk.withContext(function($ctx1) {
  2941. var $1,$2,$3,$5,$6,$4,$7,$8;
  2942. self._nonIndexesDo_((function(each){
  2943. var collection;
  2944. return smalltalk.withContext(function($ctx2) {
  2945. collection=self._collection();
  2946. $ctx2.sendIdx["collection"]=1;
  2947. collection;
  2948. self._should_raise_((function(){
  2949. return smalltalk.withContext(function($ctx3) {
  2950. return _st(collection)._removeKey_(each);
  2951. $ctx3.sendIdx["removeKey:"]=1;
  2952. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2953. $1=collection;
  2954. $2=self._collection();
  2955. $ctx2.sendIdx["collection"]=2;
  2956. return self._assert_equals_($1,$2);
  2957. $ctx2.sendIdx["assert:equals:"]=1;
  2958. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)})}));
  2959. self._samplesDo_((function(index,value){
  2960. var collection;
  2961. return smalltalk.withContext(function($ctx2) {
  2962. collection=self._collection();
  2963. $ctx2.sendIdx["collection"]=3;
  2964. collection;
  2965. $3=_st(collection)._removeKey_(index);
  2966. $ctx2.sendIdx["removeKey:"]=2;
  2967. self._assert_equals_($3,value);
  2968. $ctx2.sendIdx["assert:equals:"]=2;
  2969. $5=collection;
  2970. $6=self._collection();
  2971. $ctx2.sendIdx["collection"]=4;
  2972. $4=_st($5).__eq($6);
  2973. return self._deny_($4);
  2974. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)})}));
  2975. $7=self._collectionWithNewValue();
  2976. _st($7)._removeKey_(self._sampleNewIndex());
  2977. $8=_st($7)._yourself();
  2978. self._assert_equals_($8,self._collection());
  2979. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},globals.AssociativeCollectionTest)})},
  2980. args: [],
  2981. source: "testRemoveKey\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self should: [ collection removeKey: each ] raise: Error.\x0a\x09\x09self assert: collection equals: self collection ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: index) equals: value.\x0a\x09\x09self deny: collection = self collection ].\x0a\x09self\x0a\x09\x09assert: (self collectionWithNewValue removeKey: self sampleNewIndex; yourself)\x0a\x09\x09equals: self collection",
  2982. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"],
  2983. referencedClasses: ["Error"]
  2984. }),
  2985. globals.AssociativeCollectionTest);
  2986. smalltalk.addMethod(
  2987. smalltalk.method({
  2988. selector: "testRemoveKeyIfAbsent",
  2989. protocol: 'tests',
  2990. fn: function (){
  2991. var self=this;
  2992. return smalltalk.withContext(function($ctx1) {
  2993. var $1,$2,$3,$4,$5,$7,$8,$6,$9,$10;
  2994. self._nonIndexesDo_((function(each){
  2995. var collection;
  2996. return smalltalk.withContext(function($ctx2) {
  2997. collection=self._collection();
  2998. $ctx2.sendIdx["collection"]=1;
  2999. collection;
  3000. $1=_st(collection)._removeKey_ifAbsent_(each,(function(){
  3001. return smalltalk.withContext(function($ctx3) {
  3002. return self._sampleNewValue();
  3003. $ctx3.sendIdx["sampleNewValue"]=1;
  3004. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  3005. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  3006. $2=self._sampleNewValue();
  3007. $ctx2.sendIdx["sampleNewValue"]=2;
  3008. self._assert_equals_($1,$2);
  3009. $ctx2.sendIdx["assert:equals:"]=1;
  3010. $3=collection;
  3011. $4=self._collection();
  3012. $ctx2.sendIdx["collection"]=2;
  3013. return self._assert_equals_($3,$4);
  3014. $ctx2.sendIdx["assert:equals:"]=2;
  3015. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)})}));
  3016. self._samplesDo_((function(index,value){
  3017. var collection;
  3018. return smalltalk.withContext(function($ctx2) {
  3019. collection=self._collection();
  3020. $ctx2.sendIdx["collection"]=3;
  3021. collection;
  3022. $5=_st(collection)._removeKey_ifAbsent_(index,(function(){
  3023. return smalltalk.withContext(function($ctx3) {
  3024. return self._sampleNewValue();
  3025. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})}));
  3026. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  3027. self._assert_equals_($5,value);
  3028. $ctx2.sendIdx["assert:equals:"]=3;
  3029. $7=collection;
  3030. $8=self._collection();
  3031. $ctx2.sendIdx["collection"]=4;
  3032. $6=_st($7).__eq($8);
  3033. return self._deny_($6);
  3034. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)})}));
  3035. $9=self._collectionWithNewValue();
  3036. _st($9)._removeKey_ifAbsent_(self._sampleNewIndex(),(function(){
  3037. return smalltalk.withContext(function($ctx2) {
  3038. return self._assert_(false);
  3039. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  3040. $10=_st($9)._yourself();
  3041. self._assert_equals_($10,self._collection());
  3042. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},globals.AssociativeCollectionTest)})},
  3043. args: [],
  3044. source: "testRemoveKeyIfAbsent\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: each ifAbsent: [ self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09\x09self assert: collection equals: self collection ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09| collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09self assert: (collection removeKey: index ifAbsent: [ self sampleNewValue ]) equals: value.\x0a\x09\x09self deny: collection = self collection ].\x0a\x09self\x0a\x09\x09assert: (self collectionWithNewValue removeKey: self sampleNewIndex ifAbsent: [ self assert: false ]; yourself)\x0a\x09\x09equals: self collection",
  3045. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"],
  3046. referencedClasses: []
  3047. }),
  3048. globals.AssociativeCollectionTest);
  3049. smalltalk.addMethod(
  3050. smalltalk.method({
  3051. selector: "testValues",
  3052. protocol: 'tests',
  3053. fn: function (){
  3054. var self=this;
  3055. return smalltalk.withContext(function($ctx1) {
  3056. var $2,$1,$3,$4;
  3057. $2=_st(_st(self._collectionClass())._new())._values();
  3058. $ctx1.sendIdx["values"]=1;
  3059. $1=_st($2)._isEmpty();
  3060. self._assert_($1);
  3061. $3=_st(self._collection())._values();
  3062. $ctx1.sendIdx["values"]=2;
  3063. $4=self._collectionValues();
  3064. $ctx1.sendIdx["collectionValues"]=1;
  3065. self._assertSameContents_as_($3,$4);
  3066. $ctx1.sendIdx["assertSameContents:as:"]=1;
  3067. self._assertSameContents_as_(_st(self._collectionWithNewValue())._values(),_st(self._collectionValues()).__comma([self._sampleNewValue()]));
  3068. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{},globals.AssociativeCollectionTest)})},
  3069. args: [],
  3070. source: "testValues\x0a\x09self assert:self collectionClass new values isEmpty.\x0a\x09self assertSameContents:self collection values as: self collectionValues.\x0a\x09self assertSameContents:self collectionWithNewValue values as: self collectionValues, { self sampleNewValue }",
  3071. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"],
  3072. referencedClasses: []
  3073. }),
  3074. globals.AssociativeCollectionTest);
  3075. smalltalk.addClass('DictionaryTest', globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  3076. smalltalk.addMethod(
  3077. smalltalk.method({
  3078. selector: "collection",
  3079. protocol: 'fixture',
  3080. fn: function (){
  3081. var self=this;
  3082. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3083. return smalltalk.withContext(function($ctx1) {
  3084. var $2,$3,$1;
  3085. $2=_st($Dictionary())._new();
  3086. _st($2)._at_put_((1),(1));
  3087. $ctx1.sendIdx["at:put:"]=1;
  3088. _st($2)._at_put_("a",(2));
  3089. $ctx1.sendIdx["at:put:"]=2;
  3090. _st($2)._at_put_(true,(3));
  3091. $ctx1.sendIdx["at:put:"]=3;
  3092. _st($2)._at_put_((1).__at((3)),(-4));
  3093. $3=_st($2)._yourself();
  3094. $1=$3;
  3095. return $1;
  3096. }, function($ctx1) {$ctx1.fill(self,"collection",{},globals.DictionaryTest)})},
  3097. args: [],
  3098. 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",
  3099. messageSends: ["at:put:", "new", "@", "yourself"],
  3100. referencedClasses: ["Dictionary"]
  3101. }),
  3102. globals.DictionaryTest);
  3103. smalltalk.addMethod(
  3104. smalltalk.method({
  3105. selector: "collectionKeys",
  3106. protocol: 'fixture',
  3107. fn: function (){
  3108. var self=this;
  3109. return smalltalk.withContext(function($ctx1) {
  3110. var $1;
  3111. $1=[(1),"a",true,(1).__at((3))];
  3112. return $1;
  3113. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},globals.DictionaryTest)})},
  3114. args: [],
  3115. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3}",
  3116. messageSends: ["@"],
  3117. referencedClasses: []
  3118. }),
  3119. globals.DictionaryTest);
  3120. smalltalk.addMethod(
  3121. smalltalk.method({
  3122. selector: "collectionOfPrintStrings",
  3123. protocol: 'fixture',
  3124. fn: function (){
  3125. var self=this;
  3126. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3127. return smalltalk.withContext(function($ctx1) {
  3128. var $2,$3,$1;
  3129. $2=_st($Dictionary())._new();
  3130. _st($2)._at_put_((1),"1");
  3131. $ctx1.sendIdx["at:put:"]=1;
  3132. _st($2)._at_put_("a","2");
  3133. $ctx1.sendIdx["at:put:"]=2;
  3134. _st($2)._at_put_(true,"3");
  3135. $ctx1.sendIdx["at:put:"]=3;
  3136. _st($2)._at_put_((1).__at((3)),"-4");
  3137. $3=_st($2)._yourself();
  3138. $1=$3;
  3139. return $1;
  3140. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.DictionaryTest)})},
  3141. args: [],
  3142. 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",
  3143. messageSends: ["at:put:", "new", "@", "yourself"],
  3144. referencedClasses: ["Dictionary"]
  3145. }),
  3146. globals.DictionaryTest);
  3147. smalltalk.addMethod(
  3148. smalltalk.method({
  3149. selector: "collectionSize",
  3150. protocol: 'fixture',
  3151. fn: function (){
  3152. var self=this;
  3153. return (4);
  3154. },
  3155. args: [],
  3156. source: "collectionSize\x0a\x09^ 4",
  3157. messageSends: [],
  3158. referencedClasses: []
  3159. }),
  3160. globals.DictionaryTest);
  3161. smalltalk.addMethod(
  3162. smalltalk.method({
  3163. selector: "collectionValues",
  3164. protocol: 'fixture',
  3165. fn: function (){
  3166. var self=this;
  3167. var $1;
  3168. $1=[(1),(2),(3),(-4)];
  3169. return $1;
  3170. },
  3171. args: [],
  3172. source: "collectionValues\x0a\x09^ {1. 2. 3. -4}",
  3173. messageSends: [],
  3174. referencedClasses: []
  3175. }),
  3176. globals.DictionaryTest);
  3177. smalltalk.addMethod(
  3178. smalltalk.method({
  3179. selector: "collectionWithDuplicates",
  3180. protocol: 'fixture',
  3181. fn: function (){
  3182. var self=this;
  3183. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3184. return smalltalk.withContext(function($ctx1) {
  3185. var $2,$3,$1;
  3186. $2=_st($Dictionary())._new();
  3187. _st($2)._at_put_((1),(1));
  3188. $ctx1.sendIdx["at:put:"]=1;
  3189. _st($2)._at_put_("a",(2));
  3190. $ctx1.sendIdx["at:put:"]=2;
  3191. _st($2)._at_put_(true,(3));
  3192. $ctx1.sendIdx["at:put:"]=3;
  3193. _st($2)._at_put_((4),(-4));
  3194. $ctx1.sendIdx["at:put:"]=4;
  3195. _st($2)._at_put_("b",(1));
  3196. $ctx1.sendIdx["at:put:"]=5;
  3197. _st($2)._at_put_((3),(3));
  3198. $ctx1.sendIdx["at:put:"]=6;
  3199. _st($2)._at_put_(false,(12));
  3200. $3=_st($2)._yourself();
  3201. $1=$3;
  3202. return $1;
  3203. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.DictionaryTest)})},
  3204. args: [],
  3205. 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",
  3206. messageSends: ["at:put:", "new", "yourself"],
  3207. referencedClasses: ["Dictionary"]
  3208. }),
  3209. globals.DictionaryTest);
  3210. smalltalk.addMethod(
  3211. smalltalk.method({
  3212. selector: "collectionWithNewValue",
  3213. protocol: 'fixture',
  3214. fn: function (){
  3215. var self=this;
  3216. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3217. return smalltalk.withContext(function($ctx1) {
  3218. var $2,$3,$1;
  3219. $2=_st($Dictionary())._new();
  3220. _st($2)._at_put_((1),(1));
  3221. $ctx1.sendIdx["at:put:"]=1;
  3222. _st($2)._at_put_("a",(2));
  3223. $ctx1.sendIdx["at:put:"]=2;
  3224. _st($2)._at_put_(true,(3));
  3225. $ctx1.sendIdx["at:put:"]=3;
  3226. _st($2)._at_put_((1).__at((3)),(-4));
  3227. $ctx1.sendIdx["at:put:"]=4;
  3228. _st($2)._at_put_("new","N");
  3229. $3=_st($2)._yourself();
  3230. $1=$3;
  3231. return $1;
  3232. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.DictionaryTest)})},
  3233. args: [],
  3234. 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",
  3235. messageSends: ["at:put:", "new", "@", "yourself"],
  3236. referencedClasses: ["Dictionary"]
  3237. }),
  3238. globals.DictionaryTest);
  3239. smalltalk.addMethod(
  3240. smalltalk.method({
  3241. selector: "sampleNewValueAsCollection",
  3242. protocol: 'fixture',
  3243. fn: function (){
  3244. var self=this;
  3245. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3246. return smalltalk.withContext(function($ctx1) {
  3247. var $2,$3,$1;
  3248. $2=_st($Dictionary())._new();
  3249. _st($2)._at_put_("new","N");
  3250. $3=_st($2)._yourself();
  3251. $1=$3;
  3252. return $1;
  3253. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},globals.DictionaryTest)})},
  3254. args: [],
  3255. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  3256. messageSends: ["at:put:", "new", "yourself"],
  3257. referencedClasses: ["Dictionary"]
  3258. }),
  3259. globals.DictionaryTest);
  3260. smalltalk.addMethod(
  3261. smalltalk.method({
  3262. selector: "samplesDo:",
  3263. protocol: 'fixture',
  3264. fn: function (aBlock){
  3265. var self=this;
  3266. return smalltalk.withContext(function($ctx1) {
  3267. ($ctx1.supercall = true, globals.DictionaryTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]));
  3268. $ctx1.supercall = false;
  3269. _st(aBlock)._value_value_(true,(3));
  3270. $ctx1.sendIdx["value:value:"]=1;
  3271. _st(aBlock)._value_value_((1).__at((3)),(-4));
  3272. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.DictionaryTest)})},
  3273. args: ["aBlock"],
  3274. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4",
  3275. messageSends: ["samplesDo:", "value:value:", "@"],
  3276. referencedClasses: []
  3277. }),
  3278. globals.DictionaryTest);
  3279. smalltalk.addMethod(
  3280. smalltalk.method({
  3281. selector: "testAccessing",
  3282. protocol: 'tests',
  3283. fn: function (){
  3284. var self=this;
  3285. var d;
  3286. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3287. return smalltalk.withContext(function($ctx1) {
  3288. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  3289. d=_st($Dictionary())._new();
  3290. _st(d)._at_put_("hello","world");
  3291. $ctx1.sendIdx["at:put:"]=1;
  3292. $1=_st(d)._at_("hello");
  3293. $ctx1.sendIdx["at:"]=1;
  3294. self._assert_equals_($1,"world");
  3295. $ctx1.sendIdx["assert:equals:"]=1;
  3296. $2=_st(d)._at_ifAbsent_("hello",(function(){
  3297. return nil;
  3298. }));
  3299. $ctx1.sendIdx["at:ifAbsent:"]=1;
  3300. self._assert_equals_($2,"world");
  3301. $ctx1.sendIdx["assert:equals:"]=2;
  3302. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  3303. return nil;
  3304. }))).__eq("world"));
  3305. $ctx1.sendIdx["deny:"]=1;
  3306. $3=_st(d)._includesKey_("hello");
  3307. $ctx1.sendIdx["includesKey:"]=1;
  3308. self._assert_($3);
  3309. $ctx1.sendIdx["assert:"]=1;
  3310. $4=_st(d)._includesKey_("foo");
  3311. $ctx1.sendIdx["includesKey:"]=2;
  3312. self._deny_($4);
  3313. $ctx1.sendIdx["deny:"]=2;
  3314. _st(d)._at_put_((1),(2));
  3315. $ctx1.sendIdx["at:put:"]=2;
  3316. $5=_st(d)._at_((1));
  3317. $ctx1.sendIdx["at:"]=2;
  3318. self._assert_equals_($5,(2));
  3319. $ctx1.sendIdx["assert:equals:"]=3;
  3320. $6=d;
  3321. $7=(1).__at((3));
  3322. $ctx1.sendIdx["@"]=1;
  3323. _st($6)._at_put_($7,(3));
  3324. $9=d;
  3325. $10=(1).__at((3));
  3326. $ctx1.sendIdx["@"]=2;
  3327. $8=_st($9)._at_($10);
  3328. self._assert_equals_($8,(3));
  3329. $12=d;
  3330. $13=(1).__at((3));
  3331. $ctx1.sendIdx["@"]=3;
  3332. $11=_st($12)._includesKey_($13);
  3333. $ctx1.sendIdx["includesKey:"]=3;
  3334. self._assert_($11);
  3335. self._deny_(_st(d)._includesKey_((3).__at((1))));
  3336. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},globals.DictionaryTest)})},
  3337. args: [],
  3338. 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)",
  3339. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  3340. referencedClasses: ["Dictionary"]
  3341. }),
  3342. globals.DictionaryTest);
  3343. smalltalk.addMethod(
  3344. smalltalk.method({
  3345. selector: "testDynamicDictionaries",
  3346. protocol: 'tests',
  3347. fn: function (){
  3348. var self=this;
  3349. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3350. return smalltalk.withContext(function($ctx1) {
  3351. self._assert_equals_(_st(globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),_st($Dictionary())._with_("hello".__minus_gt((1))));
  3352. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},globals.DictionaryTest)})},
  3353. args: [],
  3354. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  3355. messageSends: ["assert:equals:", "asDictionary", "with:", "->"],
  3356. referencedClasses: ["Dictionary"]
  3357. }),
  3358. globals.DictionaryTest);
  3359. smalltalk.addMethod(
  3360. smalltalk.method({
  3361. selector: "collectionClass",
  3362. protocol: 'fixture',
  3363. fn: function (){
  3364. var self=this;
  3365. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3366. return $Dictionary();
  3367. },
  3368. args: [],
  3369. source: "collectionClass\x0a\x09^ Dictionary",
  3370. messageSends: [],
  3371. referencedClasses: ["Dictionary"]
  3372. }),
  3373. globals.DictionaryTest.klass);
  3374. smalltalk.addClass('HashedCollectionTest', globals.AssociativeCollectionTest, [], 'Kernel-Tests');
  3375. smalltalk.addMethod(
  3376. smalltalk.method({
  3377. selector: "collection",
  3378. protocol: 'fixture',
  3379. fn: function (){
  3380. var self=this;
  3381. var $1;
  3382. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  3383. return $1;
  3384. },
  3385. args: [],
  3386. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  3387. messageSends: [],
  3388. referencedClasses: []
  3389. }),
  3390. globals.HashedCollectionTest);
  3391. smalltalk.addMethod(
  3392. smalltalk.method({
  3393. selector: "collectionKeys",
  3394. protocol: 'fixture',
  3395. fn: function (){
  3396. var self=this;
  3397. var $1;
  3398. $1=["b","a","c","d"];
  3399. return $1;
  3400. },
  3401. args: [],
  3402. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  3403. messageSends: [],
  3404. referencedClasses: []
  3405. }),
  3406. globals.HashedCollectionTest);
  3407. smalltalk.addMethod(
  3408. smalltalk.method({
  3409. selector: "collectionOfPrintStrings",
  3410. protocol: 'fixture',
  3411. fn: function (){
  3412. var self=this;
  3413. var $1;
  3414. $1=globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  3415. return $1;
  3416. },
  3417. args: [],
  3418. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  3419. messageSends: [],
  3420. referencedClasses: []
  3421. }),
  3422. globals.HashedCollectionTest);
  3423. smalltalk.addMethod(
  3424. smalltalk.method({
  3425. selector: "collectionSize",
  3426. protocol: 'fixture',
  3427. fn: function (){
  3428. var self=this;
  3429. return (4);
  3430. },
  3431. args: [],
  3432. source: "collectionSize\x0a\x09^ 4",
  3433. messageSends: [],
  3434. referencedClasses: []
  3435. }),
  3436. globals.HashedCollectionTest);
  3437. smalltalk.addMethod(
  3438. smalltalk.method({
  3439. selector: "collectionValues",
  3440. protocol: 'fixture',
  3441. fn: function (){
  3442. var self=this;
  3443. var $1;
  3444. $1=[(1),(2),(3),(-4)];
  3445. return $1;
  3446. },
  3447. args: [],
  3448. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  3449. messageSends: [],
  3450. referencedClasses: []
  3451. }),
  3452. globals.HashedCollectionTest);
  3453. smalltalk.addMethod(
  3454. smalltalk.method({
  3455. selector: "collectionWithDuplicates",
  3456. protocol: 'fixture',
  3457. fn: function (){
  3458. var self=this;
  3459. var $1;
  3460. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10)]);
  3461. return $1;
  3462. },
  3463. args: [],
  3464. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  3465. messageSends: [],
  3466. referencedClasses: []
  3467. }),
  3468. globals.HashedCollectionTest);
  3469. smalltalk.addMethod(
  3470. smalltalk.method({
  3471. selector: "collectionWithNewValue",
  3472. protocol: 'fixture',
  3473. fn: function (){
  3474. var self=this;
  3475. var $1;
  3476. $1=globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  3477. return $1;
  3478. },
  3479. args: [],
  3480. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  3481. messageSends: [],
  3482. referencedClasses: []
  3483. }),
  3484. globals.HashedCollectionTest);
  3485. smalltalk.addMethod(
  3486. smalltalk.method({
  3487. selector: "sampleNewValueAsCollection",
  3488. protocol: 'fixture',
  3489. fn: function (){
  3490. var self=this;
  3491. var $1;
  3492. $1=globals.HashedCollection._newFromPairs_(["new","N"]);
  3493. return $1;
  3494. },
  3495. args: [],
  3496. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  3497. messageSends: [],
  3498. referencedClasses: []
  3499. }),
  3500. globals.HashedCollectionTest);
  3501. smalltalk.addMethod(
  3502. smalltalk.method({
  3503. selector: "testDynamicDictionaries",
  3504. protocol: 'tests',
  3505. fn: function (){
  3506. var self=this;
  3507. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3508. return smalltalk.withContext(function($ctx1) {
  3509. self._assert_equals_(_st(globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),_st($HashedCollection())._with_("hello".__minus_gt((1))));
  3510. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},globals.HashedCollectionTest)})},
  3511. args: [],
  3512. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  3513. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"],
  3514. referencedClasses: ["HashedCollection"]
  3515. }),
  3516. globals.HashedCollectionTest);
  3517. smalltalk.addMethod(
  3518. smalltalk.method({
  3519. selector: "collectionClass",
  3520. protocol: 'fixture',
  3521. fn: function (){
  3522. var self=this;
  3523. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  3524. return $HashedCollection();
  3525. },
  3526. args: [],
  3527. source: "collectionClass\x0a\x09^ HashedCollection",
  3528. messageSends: [],
  3529. referencedClasses: ["HashedCollection"]
  3530. }),
  3531. globals.HashedCollectionTest.klass);
  3532. smalltalk.addClass('SequenceableCollectionTest', globals.IndexableCollectionTest, [], 'Kernel-Tests');
  3533. smalltalk.addMethod(
  3534. smalltalk.method({
  3535. selector: "collectionFirst",
  3536. protocol: 'fixture',
  3537. fn: function (){
  3538. var self=this;
  3539. return smalltalk.withContext(function($ctx1) {
  3540. self._subclassResponsibility();
  3541. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},globals.SequenceableCollectionTest)})},
  3542. args: [],
  3543. source: "collectionFirst\x0a\x09self subclassResponsibility",
  3544. messageSends: ["subclassResponsibility"],
  3545. referencedClasses: []
  3546. }),
  3547. globals.SequenceableCollectionTest);
  3548. smalltalk.addMethod(
  3549. smalltalk.method({
  3550. selector: "collectionFirstTwo",
  3551. protocol: 'fixture',
  3552. fn: function (){
  3553. var self=this;
  3554. return smalltalk.withContext(function($ctx1) {
  3555. self._subclassResponsibility();
  3556. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},globals.SequenceableCollectionTest)})},
  3557. args: [],
  3558. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  3559. messageSends: ["subclassResponsibility"],
  3560. referencedClasses: []
  3561. }),
  3562. globals.SequenceableCollectionTest);
  3563. smalltalk.addMethod(
  3564. smalltalk.method({
  3565. selector: "collectionLast",
  3566. protocol: 'fixture',
  3567. fn: function (){
  3568. var self=this;
  3569. return smalltalk.withContext(function($ctx1) {
  3570. self._subclassResponsibility();
  3571. return self}, function($ctx1) {$ctx1.fill(self,"collectionLast",{},globals.SequenceableCollectionTest)})},
  3572. args: [],
  3573. source: "collectionLast\x0a\x09self subclassResponsibility",
  3574. messageSends: ["subclassResponsibility"],
  3575. referencedClasses: []
  3576. }),
  3577. globals.SequenceableCollectionTest);
  3578. smalltalk.addMethod(
  3579. smalltalk.method({
  3580. selector: "collectionLastTwo",
  3581. protocol: 'fixture',
  3582. fn: function (){
  3583. var self=this;
  3584. return smalltalk.withContext(function($ctx1) {
  3585. self._subclassResponsibility();
  3586. return self}, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},globals.SequenceableCollectionTest)})},
  3587. args: [],
  3588. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  3589. messageSends: ["subclassResponsibility"],
  3590. referencedClasses: []
  3591. }),
  3592. globals.SequenceableCollectionTest);
  3593. smalltalk.addMethod(
  3594. smalltalk.method({
  3595. selector: "nonIndexesDo:",
  3596. protocol: 'fixture',
  3597. fn: function (aBlock){
  3598. var self=this;
  3599. return smalltalk.withContext(function($ctx1) {
  3600. _st(aBlock)._value_((0));
  3601. $ctx1.sendIdx["value:"]=1;
  3602. _st(aBlock)._value_(_st(self._collectionSize()).__plus((1)));
  3603. $ctx1.sendIdx["value:"]=2;
  3604. _st(aBlock)._value_("z");
  3605. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},globals.SequenceableCollectionTest)})},
  3606. args: ["aBlock"],
  3607. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  3608. messageSends: ["value:", "+", "collectionSize"],
  3609. referencedClasses: []
  3610. }),
  3611. globals.SequenceableCollectionTest);
  3612. smalltalk.addMethod(
  3613. smalltalk.method({
  3614. selector: "samplesDo:",
  3615. protocol: 'fixture',
  3616. fn: function (aBlock){
  3617. var self=this;
  3618. return smalltalk.withContext(function($ctx1) {
  3619. _st(aBlock)._value_value_((1),self._collectionFirst());
  3620. $ctx1.sendIdx["value:value:"]=1;
  3621. _st(aBlock)._value_value_(self._collectionSize(),self._collectionLast());
  3622. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.SequenceableCollectionTest)})},
  3623. args: ["aBlock"],
  3624. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  3625. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"],
  3626. referencedClasses: []
  3627. }),
  3628. globals.SequenceableCollectionTest);
  3629. smalltalk.addMethod(
  3630. smalltalk.method({
  3631. selector: "testBeginsWith",
  3632. protocol: 'tests',
  3633. fn: function (){
  3634. var self=this;
  3635. return smalltalk.withContext(function($ctx1) {
  3636. var $2,$1,$4,$5,$3,$7,$6;
  3637. $2=self._collection();
  3638. $ctx1.sendIdx["collection"]=1;
  3639. $1=_st($2)._beginsWith_(_st(self._collectionClass())._new());
  3640. $ctx1.sendIdx["beginsWith:"]=1;
  3641. self._assert_($1);
  3642. $ctx1.sendIdx["assert:"]=1;
  3643. $4=self._collection();
  3644. $ctx1.sendIdx["collection"]=2;
  3645. $5=self._collection();
  3646. $ctx1.sendIdx["collection"]=3;
  3647. $3=_st($4)._beginsWith_($5);
  3648. $ctx1.sendIdx["beginsWith:"]=2;
  3649. self._assert_($3);
  3650. $ctx1.sendIdx["assert:"]=2;
  3651. $7=self._collection();
  3652. $ctx1.sendIdx["collection"]=4;
  3653. $6=_st($7)._beginsWith_(self._collectionFirstTwo());
  3654. $ctx1.sendIdx["beginsWith:"]=3;
  3655. self._assert_($6);
  3656. self._deny_(_st(self._collection())._beginsWith_(self._collectionLastTwo()));
  3657. return self}, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},globals.SequenceableCollectionTest)})},
  3658. args: [],
  3659. 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)",
  3660. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"],
  3661. referencedClasses: []
  3662. }),
  3663. globals.SequenceableCollectionTest);
  3664. smalltalk.addMethod(
  3665. smalltalk.method({
  3666. selector: "testEndsWith",
  3667. protocol: 'tests',
  3668. fn: function (){
  3669. var self=this;
  3670. return smalltalk.withContext(function($ctx1) {
  3671. var $2,$1,$4,$5,$3,$7,$6;
  3672. $2=self._collection();
  3673. $ctx1.sendIdx["collection"]=1;
  3674. $1=_st($2)._endsWith_(_st(self._collectionClass())._new());
  3675. $ctx1.sendIdx["endsWith:"]=1;
  3676. self._assert_($1);
  3677. $ctx1.sendIdx["assert:"]=1;
  3678. $4=self._collection();
  3679. $ctx1.sendIdx["collection"]=2;
  3680. $5=self._collection();
  3681. $ctx1.sendIdx["collection"]=3;
  3682. $3=_st($4)._endsWith_($5);
  3683. $ctx1.sendIdx["endsWith:"]=2;
  3684. self._assert_($3);
  3685. $ctx1.sendIdx["assert:"]=2;
  3686. $7=self._collection();
  3687. $ctx1.sendIdx["collection"]=4;
  3688. $6=_st($7)._endsWith_(self._collectionLastTwo());
  3689. $ctx1.sendIdx["endsWith:"]=3;
  3690. self._assert_($6);
  3691. self._deny_(_st(self._collection())._endsWith_(self._collectionFirstTwo()));
  3692. return self}, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},globals.SequenceableCollectionTest)})},
  3693. args: [],
  3694. 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)",
  3695. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"],
  3696. referencedClasses: []
  3697. }),
  3698. globals.SequenceableCollectionTest);
  3699. smalltalk.addMethod(
  3700. smalltalk.method({
  3701. selector: "testFirst",
  3702. protocol: 'tests',
  3703. fn: function (){
  3704. var self=this;
  3705. return smalltalk.withContext(function($ctx1) {
  3706. self._assert_equals_(_st(self._collection())._first(),self._collectionFirst());
  3707. return self}, function($ctx1) {$ctx1.fill(self,"testFirst",{},globals.SequenceableCollectionTest)})},
  3708. args: [],
  3709. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  3710. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"],
  3711. referencedClasses: []
  3712. }),
  3713. globals.SequenceableCollectionTest);
  3714. smalltalk.addMethod(
  3715. smalltalk.method({
  3716. selector: "testFirstN",
  3717. protocol: 'tests',
  3718. fn: function (){
  3719. var self=this;
  3720. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  3721. return smalltalk.withContext(function($ctx1) {
  3722. var $2,$1,$4,$3,$6,$5,$7;
  3723. $2=self._collection();
  3724. $ctx1.sendIdx["collection"]=1;
  3725. $1=_st($2)._first_((2));
  3726. $ctx1.sendIdx["first:"]=1;
  3727. self._assert_equals_($1,self._collectionFirstTwo());
  3728. $ctx1.sendIdx["assert:equals:"]=1;
  3729. $4=self._collection();
  3730. $ctx1.sendIdx["collection"]=2;
  3731. $3=_st($4)._first_((0));
  3732. $ctx1.sendIdx["first:"]=2;
  3733. self._assert_equals_($3,_st(self._collectionClass())._new());
  3734. $ctx1.sendIdx["assert:equals:"]=2;
  3735. $6=self._collection();
  3736. $ctx1.sendIdx["collection"]=3;
  3737. $5=_st($6)._first_(self._collectionSize());
  3738. $ctx1.sendIdx["first:"]=3;
  3739. $7=self._collection();
  3740. $ctx1.sendIdx["collection"]=4;
  3741. self._assert_equals_($5,$7);
  3742. self._should_raise_((function(){
  3743. return smalltalk.withContext(function($ctx2) {
  3744. return _st(self._collection())._first_((33));
  3745. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3746. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},globals.SequenceableCollectionTest)})},
  3747. args: [],
  3748. 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",
  3749. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3750. referencedClasses: ["Error"]
  3751. }),
  3752. globals.SequenceableCollectionTest);
  3753. smalltalk.addMethod(
  3754. smalltalk.method({
  3755. selector: "testFourth",
  3756. protocol: 'tests',
  3757. fn: function (){
  3758. var self=this;
  3759. return smalltalk.withContext(function($ctx1) {
  3760. var $2,$1;
  3761. $2=self._collection();
  3762. $ctx1.sendIdx["collection"]=1;
  3763. $1=_st($2)._fourth();
  3764. self._assert_equals_($1,_st(self._collection())._at_((4)));
  3765. return self}, function($ctx1) {$ctx1.fill(self,"testFourth",{},globals.SequenceableCollectionTest)})},
  3766. args: [],
  3767. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  3768. messageSends: ["assert:equals:", "fourth", "collection", "at:"],
  3769. referencedClasses: []
  3770. }),
  3771. globals.SequenceableCollectionTest);
  3772. smalltalk.addMethod(
  3773. smalltalk.method({
  3774. selector: "testIndexOfStartingAt",
  3775. protocol: 'tests',
  3776. fn: function (){
  3777. var self=this;
  3778. var jsNull;
  3779. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  3780. return smalltalk.withContext(function($ctx1) {
  3781. var $2,$1,$4,$3;
  3782. jsNull=_st($JSON())._parse_("null");
  3783. self._samplesDo_((function(index,value){
  3784. return smalltalk.withContext(function($ctx2) {
  3785. $2=self._collection();
  3786. $ctx2.sendIdx["collection"]=1;
  3787. $1=_st($2)._indexOf_startingAt_(value,(1));
  3788. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  3789. self._assert_equals_($1,index);
  3790. $ctx2.sendIdx["assert:equals:"]=1;
  3791. $4=self._collection();
  3792. $ctx2.sendIdx["collection"]=2;
  3793. $3=_st($4)._indexOf_startingAt_(value,index);
  3794. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  3795. self._assert_equals_($3,index);
  3796. $ctx2.sendIdx["assert:equals:"]=2;
  3797. return self._assert_equals_(_st(self._collection())._indexOf_startingAt_(value,_st(index).__plus((1))),(0));
  3798. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  3799. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},globals.SequenceableCollectionTest)})},
  3800. args: [],
  3801. source: "testIndexOfStartingAt\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection indexOf: value startingAt: 1) equals: index.\x0a\x09\x09self assert: (self collection indexOf: value startingAt: index) equals: index.\x0a\x09\x09self assert: (self collection indexOf: value startingAt: index+1) equals: 0 ]",
  3802. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"],
  3803. referencedClasses: ["JSON"]
  3804. }),
  3805. globals.SequenceableCollectionTest);
  3806. smalltalk.addMethod(
  3807. smalltalk.method({
  3808. selector: "testIndexOfStartingAtWithNull",
  3809. protocol: 'tests',
  3810. fn: function (){
  3811. var self=this;
  3812. var jsNull;
  3813. function $JSON(){return globals.JSON||(typeof JSON=="undefined"?nil:JSON)}
  3814. return smalltalk.withContext(function($ctx1) {
  3815. var $1,$2;
  3816. jsNull=_st($JSON())._parse_("null");
  3817. self._samplesDo_((function(index,value){
  3818. var collection;
  3819. return smalltalk.withContext(function($ctx2) {
  3820. collection=self._collection();
  3821. collection;
  3822. _st(collection)._at_put_(index,jsNull);
  3823. $1=_st(collection)._indexOf_startingAt_(jsNull,(1));
  3824. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  3825. self._assert_equals_($1,index);
  3826. $ctx2.sendIdx["assert:equals:"]=1;
  3827. $2=_st(collection)._indexOf_startingAt_(jsNull,index);
  3828. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  3829. self._assert_equals_($2,index);
  3830. $ctx2.sendIdx["assert:equals:"]=2;
  3831. return self._assert_equals_(_st(collection)._indexOf_startingAt_(jsNull,_st(index).__plus((1))),(0));
  3832. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)})}));
  3833. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},globals.SequenceableCollectionTest)})},
  3834. args: [],
  3835. source: "testIndexOfStartingAtWithNull\x0a\x09| jsNull |\x0a\x09jsNull := JSON parse: 'null'.\x0a\x09self samplesDo: [ :index :value | | collection |\x0a\x09\x09collection := self collection.\x0a\x09\x09collection at: index put: jsNull.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: 1) equals: index.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: index) equals: index.\x0a\x09\x09self assert: (collection indexOf: jsNull startingAt: index+1) equals: 0 ]",
  3836. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"],
  3837. referencedClasses: ["JSON"]
  3838. }),
  3839. globals.SequenceableCollectionTest);
  3840. smalltalk.addMethod(
  3841. smalltalk.method({
  3842. selector: "testLast",
  3843. protocol: 'tests',
  3844. fn: function (){
  3845. var self=this;
  3846. return smalltalk.withContext(function($ctx1) {
  3847. self._assert_equals_(_st(self._collection())._last(),self._collectionLast());
  3848. return self}, function($ctx1) {$ctx1.fill(self,"testLast",{},globals.SequenceableCollectionTest)})},
  3849. args: [],
  3850. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  3851. messageSends: ["assert:equals:", "last", "collection", "collectionLast"],
  3852. referencedClasses: []
  3853. }),
  3854. globals.SequenceableCollectionTest);
  3855. smalltalk.addMethod(
  3856. smalltalk.method({
  3857. selector: "testLastN",
  3858. protocol: 'tests',
  3859. fn: function (){
  3860. var self=this;
  3861. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  3862. return smalltalk.withContext(function($ctx1) {
  3863. var $2,$1,$4,$3,$6,$5,$7;
  3864. $2=self._collection();
  3865. $ctx1.sendIdx["collection"]=1;
  3866. $1=_st($2)._last_((2));
  3867. $ctx1.sendIdx["last:"]=1;
  3868. self._assert_equals_($1,self._collectionLastTwo());
  3869. $ctx1.sendIdx["assert:equals:"]=1;
  3870. $4=self._collection();
  3871. $ctx1.sendIdx["collection"]=2;
  3872. $3=_st($4)._last_((0));
  3873. $ctx1.sendIdx["last:"]=2;
  3874. self._assert_equals_($3,_st(self._collectionClass())._new());
  3875. $ctx1.sendIdx["assert:equals:"]=2;
  3876. $6=self._collection();
  3877. $ctx1.sendIdx["collection"]=3;
  3878. $5=_st($6)._last_(self._collectionSize());
  3879. $ctx1.sendIdx["last:"]=3;
  3880. $7=self._collection();
  3881. $ctx1.sendIdx["collection"]=4;
  3882. self._assert_equals_($5,$7);
  3883. self._should_raise_((function(){
  3884. return smalltalk.withContext(function($ctx2) {
  3885. return _st(self._collection())._last_((33));
  3886. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3887. return self}, function($ctx1) {$ctx1.fill(self,"testLastN",{},globals.SequenceableCollectionTest)})},
  3888. args: [],
  3889. 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",
  3890. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"],
  3891. referencedClasses: ["Error"]
  3892. }),
  3893. globals.SequenceableCollectionTest);
  3894. smalltalk.addMethod(
  3895. smalltalk.method({
  3896. selector: "testSecond",
  3897. protocol: 'tests',
  3898. fn: function (){
  3899. var self=this;
  3900. return smalltalk.withContext(function($ctx1) {
  3901. var $2,$1;
  3902. $2=self._collection();
  3903. $ctx1.sendIdx["collection"]=1;
  3904. $1=_st($2)._second();
  3905. self._assert_equals_($1,_st(self._collection())._at_((2)));
  3906. return self}, function($ctx1) {$ctx1.fill(self,"testSecond",{},globals.SequenceableCollectionTest)})},
  3907. args: [],
  3908. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  3909. messageSends: ["assert:equals:", "second", "collection", "at:"],
  3910. referencedClasses: []
  3911. }),
  3912. globals.SequenceableCollectionTest);
  3913. smalltalk.addMethod(
  3914. smalltalk.method({
  3915. selector: "testThird",
  3916. protocol: 'tests',
  3917. fn: function (){
  3918. var self=this;
  3919. return smalltalk.withContext(function($ctx1) {
  3920. var $2,$1;
  3921. $2=self._collection();
  3922. $ctx1.sendIdx["collection"]=1;
  3923. $1=_st($2)._third();
  3924. self._assert_equals_($1,_st(self._collection())._at_((3)));
  3925. return self}, function($ctx1) {$ctx1.fill(self,"testThird",{},globals.SequenceableCollectionTest)})},
  3926. args: [],
  3927. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  3928. messageSends: ["assert:equals:", "third", "collection", "at:"],
  3929. referencedClasses: []
  3930. }),
  3931. globals.SequenceableCollectionTest);
  3932. smalltalk.addClass('ArrayTest', globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  3933. smalltalk.addMethod(
  3934. smalltalk.method({
  3935. selector: "collection",
  3936. protocol: 'fixture',
  3937. fn: function (){
  3938. var self=this;
  3939. var $1;
  3940. $1=[(1), (2), (3), (-4)];
  3941. return $1;
  3942. },
  3943. args: [],
  3944. source: "collection\x0a\x09^ #(1 2 3 -4)",
  3945. messageSends: [],
  3946. referencedClasses: []
  3947. }),
  3948. globals.ArrayTest);
  3949. smalltalk.addMethod(
  3950. smalltalk.method({
  3951. selector: "collectionFirst",
  3952. protocol: 'fixture',
  3953. fn: function (){
  3954. var self=this;
  3955. return (1);
  3956. },
  3957. args: [],
  3958. source: "collectionFirst\x0a\x09^ 1",
  3959. messageSends: [],
  3960. referencedClasses: []
  3961. }),
  3962. globals.ArrayTest);
  3963. smalltalk.addMethod(
  3964. smalltalk.method({
  3965. selector: "collectionFirstTwo",
  3966. protocol: 'fixture',
  3967. fn: function (){
  3968. var self=this;
  3969. var $1;
  3970. $1=[(1), (2)];
  3971. return $1;
  3972. },
  3973. args: [],
  3974. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  3975. messageSends: [],
  3976. referencedClasses: []
  3977. }),
  3978. globals.ArrayTest);
  3979. smalltalk.addMethod(
  3980. smalltalk.method({
  3981. selector: "collectionLast",
  3982. protocol: 'fixture',
  3983. fn: function (){
  3984. var self=this;
  3985. return (-4);
  3986. },
  3987. args: [],
  3988. source: "collectionLast\x0a\x09^ -4",
  3989. messageSends: [],
  3990. referencedClasses: []
  3991. }),
  3992. globals.ArrayTest);
  3993. smalltalk.addMethod(
  3994. smalltalk.method({
  3995. selector: "collectionLastTwo",
  3996. protocol: 'fixture',
  3997. fn: function (){
  3998. var self=this;
  3999. var $1;
  4000. $1=[(3), (-4)];
  4001. return $1;
  4002. },
  4003. args: [],
  4004. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  4005. messageSends: [],
  4006. referencedClasses: []
  4007. }),
  4008. globals.ArrayTest);
  4009. smalltalk.addMethod(
  4010. smalltalk.method({
  4011. selector: "collectionOfPrintStrings",
  4012. protocol: 'fixture',
  4013. fn: function (){
  4014. var self=this;
  4015. var $1;
  4016. $1=["1", "2", "3", "-4"];
  4017. return $1;
  4018. },
  4019. args: [],
  4020. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  4021. messageSends: [],
  4022. referencedClasses: []
  4023. }),
  4024. globals.ArrayTest);
  4025. smalltalk.addMethod(
  4026. smalltalk.method({
  4027. selector: "collectionSize",
  4028. protocol: 'fixture',
  4029. fn: function (){
  4030. var self=this;
  4031. return (4);
  4032. },
  4033. args: [],
  4034. source: "collectionSize\x0a\x09^ 4",
  4035. messageSends: [],
  4036. referencedClasses: []
  4037. }),
  4038. globals.ArrayTest);
  4039. smalltalk.addMethod(
  4040. smalltalk.method({
  4041. selector: "collectionWithDuplicates",
  4042. protocol: 'fixture',
  4043. fn: function (){
  4044. var self=this;
  4045. var $1;
  4046. $1=["a", "b", "c", (1), (2), (1), "a"];
  4047. return $1;
  4048. },
  4049. args: [],
  4050. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a')",
  4051. messageSends: [],
  4052. referencedClasses: []
  4053. }),
  4054. globals.ArrayTest);
  4055. smalltalk.addMethod(
  4056. smalltalk.method({
  4057. selector: "collectionWithNewValue",
  4058. protocol: 'fixture',
  4059. fn: function (){
  4060. var self=this;
  4061. var $1;
  4062. $1=[(1), (2), (3), (-4), "N"];
  4063. return $1;
  4064. },
  4065. args: [],
  4066. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  4067. messageSends: [],
  4068. referencedClasses: []
  4069. }),
  4070. globals.ArrayTest);
  4071. smalltalk.addMethod(
  4072. smalltalk.method({
  4073. selector: "sampleNewIndex",
  4074. protocol: 'fixture',
  4075. fn: function (){
  4076. var self=this;
  4077. return (5);
  4078. },
  4079. args: [],
  4080. source: "sampleNewIndex\x0a\x09^ 5",
  4081. messageSends: [],
  4082. referencedClasses: []
  4083. }),
  4084. globals.ArrayTest);
  4085. smalltalk.addMethod(
  4086. smalltalk.method({
  4087. selector: "samplesDo:",
  4088. protocol: 'fixture',
  4089. fn: function (aBlock){
  4090. var self=this;
  4091. return smalltalk.withContext(function($ctx1) {
  4092. ($ctx1.supercall = true, globals.ArrayTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]));
  4093. $ctx1.supercall = false;
  4094. _st(aBlock)._value_value_((3),(3));
  4095. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.ArrayTest)})},
  4096. args: ["aBlock"],
  4097. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  4098. messageSends: ["samplesDo:", "value:value:"],
  4099. referencedClasses: []
  4100. }),
  4101. globals.ArrayTest);
  4102. smalltalk.addMethod(
  4103. smalltalk.method({
  4104. selector: "testAdd",
  4105. protocol: 'tests',
  4106. fn: function (){
  4107. var self=this;
  4108. var array;
  4109. return smalltalk.withContext(function($ctx1) {
  4110. array=self._collection();
  4111. _st(array)._add_((6));
  4112. self._assert_equals_(_st(array)._last(),(6));
  4113. return self}, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},globals.ArrayTest)})},
  4114. args: [],
  4115. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  4116. messageSends: ["collection", "add:", "assert:equals:", "last"],
  4117. referencedClasses: []
  4118. }),
  4119. globals.ArrayTest);
  4120. smalltalk.addMethod(
  4121. smalltalk.method({
  4122. selector: "testAddFirst",
  4123. protocol: 'tests',
  4124. fn: function (){
  4125. var self=this;
  4126. return smalltalk.withContext(function($ctx1) {
  4127. var $1,$2;
  4128. $1=self._collection();
  4129. _st($1)._addFirst_((0));
  4130. $2=_st($1)._yourself();
  4131. self._assert_equals_(_st($2)._first(),(0));
  4132. return self}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},globals.ArrayTest)})},
  4133. args: [],
  4134. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  4135. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"],
  4136. referencedClasses: []
  4137. }),
  4138. globals.ArrayTest);
  4139. smalltalk.addMethod(
  4140. smalltalk.method({
  4141. selector: "testPrintString",
  4142. protocol: 'tests',
  4143. fn: function (){
  4144. var self=this;
  4145. var array;
  4146. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  4147. return smalltalk.withContext(function($ctx1) {
  4148. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  4149. array=_st($Array())._new();
  4150. $1=_st(array)._printString();
  4151. $ctx1.sendIdx["printString"]=1;
  4152. self._assert_equals_($1,"an Array ()");
  4153. $ctx1.sendIdx["assert:equals:"]=1;
  4154. $2=array;
  4155. _st($2)._add_((1));
  4156. $ctx1.sendIdx["add:"]=1;
  4157. $3=_st($2)._add_((3));
  4158. $ctx1.sendIdx["add:"]=2;
  4159. $4=_st(array)._printString();
  4160. $ctx1.sendIdx["printString"]=2;
  4161. self._assert_equals_($4,"an Array (1 3)");
  4162. $ctx1.sendIdx["assert:equals:"]=2;
  4163. _st(array)._add_("foo");
  4164. $5=_st(array)._printString();
  4165. $ctx1.sendIdx["printString"]=3;
  4166. self._assert_equals_($5,"an Array (1 3 'foo')");
  4167. $ctx1.sendIdx["assert:equals:"]=3;
  4168. $6=array;
  4169. _st($6)._remove_((1));
  4170. $ctx1.sendIdx["remove:"]=1;
  4171. $7=_st($6)._remove_((3));
  4172. $8=_st(array)._printString();
  4173. $ctx1.sendIdx["printString"]=4;
  4174. self._assert_equals_($8,"an Array ('foo')");
  4175. $ctx1.sendIdx["assert:equals:"]=4;
  4176. _st(array)._addLast_((3));
  4177. $ctx1.sendIdx["addLast:"]=1;
  4178. $9=_st(array)._printString();
  4179. $ctx1.sendIdx["printString"]=5;
  4180. self._assert_equals_($9,"an Array ('foo' 3)");
  4181. $ctx1.sendIdx["assert:equals:"]=5;
  4182. _st(array)._addLast_((3));
  4183. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  4184. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},globals.ArrayTest)})},
  4185. args: [],
  4186. 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)'.",
  4187. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  4188. referencedClasses: ["Array"]
  4189. }),
  4190. globals.ArrayTest);
  4191. smalltalk.addMethod(
  4192. smalltalk.method({
  4193. selector: "testRemove",
  4194. protocol: 'tests',
  4195. fn: function (){
  4196. var self=this;
  4197. var array;
  4198. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4199. return smalltalk.withContext(function($ctx1) {
  4200. array=[(1), (2), (3), (4), (5)];
  4201. _st(array)._remove_((3));
  4202. $ctx1.sendIdx["remove:"]=1;
  4203. self._assert_equals_(array,[(1), (2), (4), (5)]);
  4204. self._should_raise_((function(){
  4205. return smalltalk.withContext(function($ctx2) {
  4206. return _st(array)._remove_((3));
  4207. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4208. return self}, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},globals.ArrayTest)})},
  4209. args: [],
  4210. 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",
  4211. messageSends: ["remove:", "assert:equals:", "should:raise:"],
  4212. referencedClasses: ["Error"]
  4213. }),
  4214. globals.ArrayTest);
  4215. smalltalk.addMethod(
  4216. smalltalk.method({
  4217. selector: "testRemoveFromTo",
  4218. protocol: 'tests',
  4219. fn: function (){
  4220. var self=this;
  4221. return smalltalk.withContext(function($ctx1) {
  4222. var $1,$2;
  4223. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  4224. $ctx1.sendIdx["removeFrom:to:"]=1;
  4225. self._assert_equals_($1,[(4)]);
  4226. $ctx1.sendIdx["assert:equals:"]=1;
  4227. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  4228. $ctx1.sendIdx["removeFrom:to:"]=2;
  4229. self._assert_equals_($2,[(1), (4)]);
  4230. $ctx1.sendIdx["assert:equals:"]=2;
  4231. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  4232. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},globals.ArrayTest)})},
  4233. args: [],
  4234. 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)",
  4235. messageSends: ["assert:equals:", "removeFrom:to:"],
  4236. referencedClasses: []
  4237. }),
  4238. globals.ArrayTest);
  4239. smalltalk.addMethod(
  4240. smalltalk.method({
  4241. selector: "testRemoveIndex",
  4242. protocol: 'tests',
  4243. fn: function (){
  4244. var self=this;
  4245. return smalltalk.withContext(function($ctx1) {
  4246. var $1,$2;
  4247. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  4248. $ctx1.sendIdx["removeIndex:"]=1;
  4249. self._assert_equals_($1,[(1), (3), (4)]);
  4250. $ctx1.sendIdx["assert:equals:"]=1;
  4251. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  4252. $ctx1.sendIdx["removeIndex:"]=2;
  4253. self._assert_equals_($2,[(2), (3), (4)]);
  4254. $ctx1.sendIdx["assert:equals:"]=2;
  4255. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  4256. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},globals.ArrayTest)})},
  4257. args: [],
  4258. 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: #()",
  4259. messageSends: ["assert:equals:", "removeIndex:"],
  4260. referencedClasses: []
  4261. }),
  4262. globals.ArrayTest);
  4263. smalltalk.addMethod(
  4264. smalltalk.method({
  4265. selector: "testRemoveLast",
  4266. protocol: 'tests',
  4267. fn: function (){
  4268. var self=this;
  4269. var array;
  4270. return smalltalk.withContext(function($ctx1) {
  4271. array=[(1), (2)];
  4272. _st(array)._removeLast();
  4273. self._assert_equals_(_st(array)._last(),(1));
  4274. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},globals.ArrayTest)})},
  4275. args: [],
  4276. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  4277. messageSends: ["removeLast", "assert:equals:", "last"],
  4278. referencedClasses: []
  4279. }),
  4280. globals.ArrayTest);
  4281. smalltalk.addMethod(
  4282. smalltalk.method({
  4283. selector: "testReversed",
  4284. protocol: 'tests',
  4285. fn: function (){
  4286. var self=this;
  4287. var array;
  4288. return smalltalk.withContext(function($ctx1) {
  4289. array=[(5), (4), (3), (2), (1)];
  4290. self._assert_equals_(_st(array)._reversed(),[(1), (2), (3), (4), (5)]);
  4291. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},globals.ArrayTest)})},
  4292. args: [],
  4293. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  4294. messageSends: ["assert:equals:", "reversed"],
  4295. referencedClasses: []
  4296. }),
  4297. globals.ArrayTest);
  4298. smalltalk.addMethod(
  4299. smalltalk.method({
  4300. selector: "testSort",
  4301. protocol: 'tests',
  4302. fn: function (){
  4303. var self=this;
  4304. var array;
  4305. return smalltalk.withContext(function($ctx1) {
  4306. array=[(10), (1), (5)];
  4307. _st(array)._sort();
  4308. self._assert_equals_(array,[(1), (5), (10)]);
  4309. return self}, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},globals.ArrayTest)})},
  4310. args: [],
  4311. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  4312. messageSends: ["sort", "assert:equals:"],
  4313. referencedClasses: []
  4314. }),
  4315. globals.ArrayTest);
  4316. smalltalk.addMethod(
  4317. smalltalk.method({
  4318. selector: "collectionClass",
  4319. protocol: 'fixture',
  4320. fn: function (){
  4321. var self=this;
  4322. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  4323. return $Array();
  4324. },
  4325. args: [],
  4326. source: "collectionClass\x0a\x09^ Array",
  4327. messageSends: [],
  4328. referencedClasses: ["Array"]
  4329. }),
  4330. globals.ArrayTest.klass);
  4331. smalltalk.addClass('StringTest', globals.SequenceableCollectionTest, [], 'Kernel-Tests');
  4332. smalltalk.addMethod(
  4333. smalltalk.method({
  4334. selector: "collection",
  4335. protocol: 'fixture',
  4336. fn: function (){
  4337. var self=this;
  4338. return "helLo";
  4339. },
  4340. args: [],
  4341. source: "collection\x0a\x09^ 'helLo'",
  4342. messageSends: [],
  4343. referencedClasses: []
  4344. }),
  4345. globals.StringTest);
  4346. smalltalk.addMethod(
  4347. smalltalk.method({
  4348. selector: "collectionFirst",
  4349. protocol: 'fixture',
  4350. fn: function (){
  4351. var self=this;
  4352. return "h";
  4353. },
  4354. args: [],
  4355. source: "collectionFirst\x0a\x09^ 'h'",
  4356. messageSends: [],
  4357. referencedClasses: []
  4358. }),
  4359. globals.StringTest);
  4360. smalltalk.addMethod(
  4361. smalltalk.method({
  4362. selector: "collectionFirstTwo",
  4363. protocol: 'fixture',
  4364. fn: function (){
  4365. var self=this;
  4366. return "he";
  4367. },
  4368. args: [],
  4369. source: "collectionFirstTwo\x0a\x09^ 'he'",
  4370. messageSends: [],
  4371. referencedClasses: []
  4372. }),
  4373. globals.StringTest);
  4374. smalltalk.addMethod(
  4375. smalltalk.method({
  4376. selector: "collectionLast",
  4377. protocol: 'fixture',
  4378. fn: function (){
  4379. var self=this;
  4380. return "o";
  4381. },
  4382. args: [],
  4383. source: "collectionLast\x0a\x09^ 'o'",
  4384. messageSends: [],
  4385. referencedClasses: []
  4386. }),
  4387. globals.StringTest);
  4388. smalltalk.addMethod(
  4389. smalltalk.method({
  4390. selector: "collectionLastTwo",
  4391. protocol: 'fixture',
  4392. fn: function (){
  4393. var self=this;
  4394. return "Lo";
  4395. },
  4396. args: [],
  4397. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  4398. messageSends: [],
  4399. referencedClasses: []
  4400. }),
  4401. globals.StringTest);
  4402. smalltalk.addMethod(
  4403. smalltalk.method({
  4404. selector: "collectionOfPrintStrings",
  4405. protocol: 'fixture',
  4406. fn: function (){
  4407. var self=this;
  4408. return "'h''e''l''L''o'";
  4409. },
  4410. args: [],
  4411. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  4412. messageSends: [],
  4413. referencedClasses: []
  4414. }),
  4415. globals.StringTest);
  4416. smalltalk.addMethod(
  4417. smalltalk.method({
  4418. selector: "collectionSize",
  4419. protocol: 'fixture',
  4420. fn: function (){
  4421. var self=this;
  4422. return (5);
  4423. },
  4424. args: [],
  4425. source: "collectionSize\x0a\x09^ 5",
  4426. messageSends: [],
  4427. referencedClasses: []
  4428. }),
  4429. globals.StringTest);
  4430. smalltalk.addMethod(
  4431. smalltalk.method({
  4432. selector: "collectionWithDuplicates",
  4433. protocol: 'fixture',
  4434. fn: function (){
  4435. var self=this;
  4436. return "abbaerte";
  4437. },
  4438. args: [],
  4439. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  4440. messageSends: [],
  4441. referencedClasses: []
  4442. }),
  4443. globals.StringTest);
  4444. smalltalk.addMethod(
  4445. smalltalk.method({
  4446. selector: "collectionWithNewValue",
  4447. protocol: 'fixture',
  4448. fn: function (){
  4449. var self=this;
  4450. return "helLoN";
  4451. },
  4452. args: [],
  4453. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  4454. messageSends: [],
  4455. referencedClasses: []
  4456. }),
  4457. globals.StringTest);
  4458. smalltalk.addMethod(
  4459. smalltalk.method({
  4460. selector: "sampleNewValueAsCollection",
  4461. protocol: 'fixture',
  4462. fn: function (){
  4463. var self=this;
  4464. return "N";
  4465. },
  4466. args: [],
  4467. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  4468. messageSends: [],
  4469. referencedClasses: []
  4470. }),
  4471. globals.StringTest);
  4472. smalltalk.addMethod(
  4473. smalltalk.method({
  4474. selector: "samplesDo:",
  4475. protocol: 'fixture',
  4476. fn: function (aBlock){
  4477. var self=this;
  4478. return smalltalk.withContext(function($ctx1) {
  4479. ($ctx1.supercall = true, globals.StringTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]));
  4480. $ctx1.supercall = false;
  4481. _st(aBlock)._value_value_((3),"l");
  4482. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},globals.StringTest)})},
  4483. args: ["aBlock"],
  4484. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  4485. messageSends: ["samplesDo:", "value:value:"],
  4486. referencedClasses: []
  4487. }),
  4488. globals.StringTest);
  4489. smalltalk.addMethod(
  4490. smalltalk.method({
  4491. selector: "testAddAll",
  4492. protocol: 'tests',
  4493. fn: function (){
  4494. var self=this;
  4495. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4496. return smalltalk.withContext(function($ctx1) {
  4497. var $1;
  4498. self._should_raise_((function(){
  4499. return smalltalk.withContext(function($ctx2) {
  4500. $1=self._collection();
  4501. $ctx2.sendIdx["collection"]=1;
  4502. return _st($1)._addAll_(self._collection());
  4503. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4504. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.StringTest)})},
  4505. args: [],
  4506. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  4507. messageSends: ["should:raise:", "addAll:", "collection"],
  4508. referencedClasses: ["Error"]
  4509. }),
  4510. globals.StringTest);
  4511. smalltalk.addMethod(
  4512. smalltalk.method({
  4513. selector: "testAddRemove",
  4514. protocol: 'tests',
  4515. fn: function (){
  4516. var self=this;
  4517. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4518. return smalltalk.withContext(function($ctx1) {
  4519. self._should_raise_((function(){
  4520. return smalltalk.withContext(function($ctx2) {
  4521. return "hello"._add_("a");
  4522. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4523. $ctx1.sendIdx["should:raise:"]=1;
  4524. self._should_raise_((function(){
  4525. return smalltalk.withContext(function($ctx2) {
  4526. return "hello"._remove_("h");
  4527. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  4528. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},globals.StringTest)})},
  4529. args: [],
  4530. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  4531. messageSends: ["should:raise:", "add:", "remove:"],
  4532. referencedClasses: ["Error"]
  4533. }),
  4534. globals.StringTest);
  4535. smalltalk.addMethod(
  4536. smalltalk.method({
  4537. selector: "testAsArray",
  4538. protocol: 'tests',
  4539. fn: function (){
  4540. var self=this;
  4541. return smalltalk.withContext(function($ctx1) {
  4542. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  4543. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},globals.StringTest)})},
  4544. args: [],
  4545. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  4546. messageSends: ["assert:equals:", "asArray"],
  4547. referencedClasses: []
  4548. }),
  4549. globals.StringTest);
  4550. smalltalk.addMethod(
  4551. smalltalk.method({
  4552. selector: "testAsLowerCase",
  4553. protocol: 'tests',
  4554. fn: function (){
  4555. var self=this;
  4556. return smalltalk.withContext(function($ctx1) {
  4557. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  4558. return self}, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},globals.StringTest)})},
  4559. args: [],
  4560. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  4561. messageSends: ["assert:equals:", "asLowercase"],
  4562. referencedClasses: []
  4563. }),
  4564. globals.StringTest);
  4565. smalltalk.addMethod(
  4566. smalltalk.method({
  4567. selector: "testAsNumber",
  4568. protocol: 'tests',
  4569. fn: function (){
  4570. var self=this;
  4571. return smalltalk.withContext(function($ctx1) {
  4572. var $1,$2;
  4573. $1="3"._asNumber();
  4574. $ctx1.sendIdx["asNumber"]=1;
  4575. self._assert_equals_($1,(3));
  4576. $ctx1.sendIdx["assert:equals:"]=1;
  4577. $2="-3"._asNumber();
  4578. $ctx1.sendIdx["asNumber"]=2;
  4579. self._assert_equals_($2,(-3));
  4580. $ctx1.sendIdx["assert:equals:"]=2;
  4581. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  4582. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},globals.StringTest)})},
  4583. args: [],
  4584. 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.",
  4585. messageSends: ["assert:equals:", "asNumber"],
  4586. referencedClasses: []
  4587. }),
  4588. globals.StringTest);
  4589. smalltalk.addMethod(
  4590. smalltalk.method({
  4591. selector: "testAsUpperCase",
  4592. protocol: 'tests',
  4593. fn: function (){
  4594. var self=this;
  4595. return smalltalk.withContext(function($ctx1) {
  4596. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  4597. return self}, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},globals.StringTest)})},
  4598. args: [],
  4599. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  4600. messageSends: ["assert:equals:", "asUppercase"],
  4601. referencedClasses: []
  4602. }),
  4603. globals.StringTest);
  4604. smalltalk.addMethod(
  4605. smalltalk.method({
  4606. selector: "testAsciiValue",
  4607. protocol: 'tests',
  4608. fn: function (){
  4609. var self=this;
  4610. var characterA,characterU;
  4611. return smalltalk.withContext(function($ctx1) {
  4612. var $1;
  4613. characterA="A";
  4614. characterU="U";
  4615. $1=_st(characterA)._asciiValue();
  4616. $ctx1.sendIdx["asciiValue"]=1;
  4617. self._assert_equals_($1,(65));
  4618. $ctx1.sendIdx["assert:equals:"]=1;
  4619. self._assert_equals_(_st(characterU)._asciiValue(),(85));
  4620. return self}, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},globals.StringTest)})},
  4621. args: [],
  4622. 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",
  4623. messageSends: ["assert:equals:", "asciiValue"],
  4624. referencedClasses: []
  4625. }),
  4626. globals.StringTest);
  4627. smalltalk.addMethod(
  4628. smalltalk.method({
  4629. selector: "testAtIfAbsentPut",
  4630. protocol: 'tests',
  4631. fn: function (){
  4632. var self=this;
  4633. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4634. return smalltalk.withContext(function($ctx1) {
  4635. self._should_raise_((function(){
  4636. return smalltalk.withContext(function($ctx2) {
  4637. return "hello"._at_ifAbsentPut_((6),(function(){
  4638. return "a";
  4639. }));
  4640. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4641. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},globals.StringTest)})},
  4642. args: [],
  4643. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  4644. messageSends: ["should:raise:", "at:ifAbsentPut:"],
  4645. referencedClasses: ["Error"]
  4646. }),
  4647. globals.StringTest);
  4648. smalltalk.addMethod(
  4649. smalltalk.method({
  4650. selector: "testAtPut",
  4651. protocol: 'tests',
  4652. fn: function (){
  4653. var self=this;
  4654. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4655. return smalltalk.withContext(function($ctx1) {
  4656. self._should_raise_((function(){
  4657. return smalltalk.withContext(function($ctx2) {
  4658. return "hello"._at_put_((1),"a");
  4659. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4660. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},globals.StringTest)})},
  4661. args: [],
  4662. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  4663. messageSends: ["should:raise:", "at:put:"],
  4664. referencedClasses: ["Error"]
  4665. }),
  4666. globals.StringTest);
  4667. smalltalk.addMethod(
  4668. smalltalk.method({
  4669. selector: "testCapitalized",
  4670. protocol: 'tests',
  4671. fn: function (){
  4672. var self=this;
  4673. return smalltalk.withContext(function($ctx1) {
  4674. var $1,$2,$3;
  4675. $1="test"._capitalized();
  4676. $ctx1.sendIdx["capitalized"]=1;
  4677. self._assert_equals_($1,"Test");
  4678. $ctx1.sendIdx["assert:equals:"]=1;
  4679. $2="Test"._capitalized();
  4680. $ctx1.sendIdx["capitalized"]=2;
  4681. self._assert_equals_($2,"Test");
  4682. $ctx1.sendIdx["assert:equals:"]=2;
  4683. self._assert_equals_(""._capitalized(),"");
  4684. $ctx1.sendIdx["assert:equals:"]=3;
  4685. $3="Test"._isCapitalized();
  4686. $ctx1.sendIdx["isCapitalized"]=1;
  4687. self._assert_equals_($3,true);
  4688. $ctx1.sendIdx["assert:equals:"]=4;
  4689. self._assert_equals_("test"._isCapitalized(),false);
  4690. return self}, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},globals.StringTest)})},
  4691. args: [],
  4692. 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.",
  4693. messageSends: ["assert:equals:", "capitalized", "isCapitalized"],
  4694. referencedClasses: []
  4695. }),
  4696. globals.StringTest);
  4697. smalltalk.addMethod(
  4698. smalltalk.method({
  4699. selector: "testCharCodeAt",
  4700. protocol: 'tests',
  4701. fn: function (){
  4702. var self=this;
  4703. return smalltalk.withContext(function($ctx1) {
  4704. var $1,$2,$3,$4,$5;
  4705. $1="jackie"._charCodeAt_((1));
  4706. $ctx1.sendIdx["charCodeAt:"]=1;
  4707. self._assert_equals_($1,(106));
  4708. $ctx1.sendIdx["assert:equals:"]=1;
  4709. $2="jackie"._charCodeAt_((2));
  4710. $ctx1.sendIdx["charCodeAt:"]=2;
  4711. self._assert_equals_($2,(97));
  4712. $ctx1.sendIdx["assert:equals:"]=2;
  4713. $3="jackie"._charCodeAt_((3));
  4714. $ctx1.sendIdx["charCodeAt:"]=3;
  4715. self._assert_equals_($3,(99));
  4716. $ctx1.sendIdx["assert:equals:"]=3;
  4717. $4="jackie"._charCodeAt_((4));
  4718. $ctx1.sendIdx["charCodeAt:"]=4;
  4719. self._assert_equals_($4,(107));
  4720. $ctx1.sendIdx["assert:equals:"]=4;
  4721. $5="jackie"._charCodeAt_((5));
  4722. $ctx1.sendIdx["charCodeAt:"]=5;
  4723. self._assert_equals_($5,(105));
  4724. $ctx1.sendIdx["assert:equals:"]=5;
  4725. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  4726. return self}, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},globals.StringTest)})},
  4727. args: [],
  4728. 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",
  4729. messageSends: ["assert:equals:", "charCodeAt:"],
  4730. referencedClasses: []
  4731. }),
  4732. globals.StringTest);
  4733. smalltalk.addMethod(
  4734. smalltalk.method({
  4735. selector: "testCopyFromTo",
  4736. protocol: 'tests',
  4737. fn: function (){
  4738. var self=this;
  4739. return smalltalk.withContext(function($ctx1) {
  4740. var $1;
  4741. $1="jackie"._copyFrom_to_((1),(3));
  4742. $ctx1.sendIdx["copyFrom:to:"]=1;
  4743. self._assert_equals_($1,"jac");
  4744. $ctx1.sendIdx["assert:equals:"]=1;
  4745. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  4746. return self}, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},globals.StringTest)})},
  4747. args: [],
  4748. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  4749. messageSends: ["assert:equals:", "copyFrom:to:"],
  4750. referencedClasses: []
  4751. }),
  4752. globals.StringTest);
  4753. smalltalk.addMethod(
  4754. smalltalk.method({
  4755. selector: "testCopyWithoutAll",
  4756. protocol: 'tests',
  4757. fn: function (){
  4758. var self=this;
  4759. return smalltalk.withContext(function($ctx1) {
  4760. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  4761. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},globals.StringTest)})},
  4762. args: [],
  4763. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  4764. messageSends: ["assert:equals:", "copyWithoutAll:"],
  4765. referencedClasses: []
  4766. }),
  4767. globals.StringTest);
  4768. smalltalk.addMethod(
  4769. smalltalk.method({
  4770. selector: "testEquality",
  4771. protocol: 'tests',
  4772. fn: function (){
  4773. var self=this;
  4774. return smalltalk.withContext(function($ctx1) {
  4775. var $1,$2,$3;
  4776. self._assert_equals_("hello","hello");
  4777. $ctx1.sendIdx["assert:equals:"]=1;
  4778. $1="hello".__eq("world");
  4779. $ctx1.sendIdx["="]=1;
  4780. self._deny_($1);
  4781. $ctx1.sendIdx["deny:"]=1;
  4782. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  4783. })));
  4784. $ctx1.sendIdx["="]=2;
  4785. self._deny_($2);
  4786. $ctx1.sendIdx["deny:"]=2;
  4787. $3="hello"._yourself();
  4788. $ctx1.sendIdx["yourself"]=1;
  4789. self._assert_equals_("hello",$3);
  4790. $ctx1.sendIdx["assert:equals:"]=2;
  4791. self._assert_equals_("hello"._yourself(),"hello");
  4792. self._deny_("".__eq((0)));
  4793. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.StringTest)})},
  4794. args: [],
  4795. 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",
  4796. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  4797. referencedClasses: []
  4798. }),
  4799. globals.StringTest);
  4800. smalltalk.addMethod(
  4801. smalltalk.method({
  4802. selector: "testIdentity",
  4803. protocol: 'tests',
  4804. fn: function (){
  4805. var self=this;
  4806. return smalltalk.withContext(function($ctx1) {
  4807. var $1,$2,$4,$3,$5;
  4808. $1="hello".__eq_eq("hello");
  4809. $ctx1.sendIdx["=="]=1;
  4810. self._assert_($1);
  4811. $ctx1.sendIdx["assert:"]=1;
  4812. $2="hello".__eq_eq("world");
  4813. $ctx1.sendIdx["=="]=2;
  4814. self._deny_($2);
  4815. $ctx1.sendIdx["deny:"]=1;
  4816. $4="hello"._yourself();
  4817. $ctx1.sendIdx["yourself"]=1;
  4818. $3="hello".__eq_eq($4);
  4819. $ctx1.sendIdx["=="]=3;
  4820. self._assert_($3);
  4821. $ctx1.sendIdx["assert:"]=2;
  4822. $5=_st("hello"._yourself()).__eq_eq("hello");
  4823. $ctx1.sendIdx["=="]=4;
  4824. self._assert_($5);
  4825. self._deny_("".__eq_eq((0)));
  4826. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.StringTest)})},
  4827. args: [],
  4828. 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",
  4829. messageSends: ["assert:", "==", "deny:", "yourself"],
  4830. referencedClasses: []
  4831. }),
  4832. globals.StringTest);
  4833. smalltalk.addMethod(
  4834. smalltalk.method({
  4835. selector: "testIdentityHash",
  4836. protocol: 'tests',
  4837. fn: function (){
  4838. var self=this;
  4839. return smalltalk.withContext(function($ctx1) {
  4840. var $1,$2,$4,$3;
  4841. $1="foo"._identityHash();
  4842. $ctx1.sendIdx["identityHash"]=1;
  4843. $2="foo"._identityHash();
  4844. $ctx1.sendIdx["identityHash"]=2;
  4845. self._assert_equals_($1,$2);
  4846. $4="foo"._identityHash();
  4847. $ctx1.sendIdx["identityHash"]=3;
  4848. $3=_st($4).__eq("bar"._identityHash());
  4849. self._deny_($3);
  4850. return self}, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},globals.StringTest)})},
  4851. args: [],
  4852. source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)",
  4853. messageSends: ["assert:equals:", "identityHash", "deny:", "="],
  4854. referencedClasses: []
  4855. }),
  4856. globals.StringTest);
  4857. smalltalk.addMethod(
  4858. smalltalk.method({
  4859. selector: "testIncludesSubString",
  4860. protocol: 'tests',
  4861. fn: function (){
  4862. var self=this;
  4863. return smalltalk.withContext(function($ctx1) {
  4864. var $1;
  4865. $1="amber"._includesSubString_("ber");
  4866. $ctx1.sendIdx["includesSubString:"]=1;
  4867. self._assert_($1);
  4868. self._deny_("amber"._includesSubString_("zork"));
  4869. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},globals.StringTest)})},
  4870. args: [],
  4871. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  4872. messageSends: ["assert:", "includesSubString:", "deny:"],
  4873. referencedClasses: []
  4874. }),
  4875. globals.StringTest);
  4876. smalltalk.addMethod(
  4877. smalltalk.method({
  4878. selector: "testIndexOfStartingAtWithNull",
  4879. protocol: 'tests',
  4880. fn: function (){
  4881. var self=this;
  4882. return self},
  4883. args: [],
  4884. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  4885. messageSends: [],
  4886. referencedClasses: []
  4887. }),
  4888. globals.StringTest);
  4889. smalltalk.addMethod(
  4890. smalltalk.method({
  4891. selector: "testIndexOfWithNull",
  4892. protocol: 'tests',
  4893. fn: function (){
  4894. var self=this;
  4895. return self},
  4896. args: [],
  4897. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  4898. messageSends: [],
  4899. referencedClasses: []
  4900. }),
  4901. globals.StringTest);
  4902. smalltalk.addMethod(
  4903. smalltalk.method({
  4904. selector: "testIsVowel",
  4905. protocol: 'tests',
  4906. fn: function (){
  4907. var self=this;
  4908. var vowel,consonant;
  4909. return smalltalk.withContext(function($ctx1) {
  4910. var $1;
  4911. vowel="u";
  4912. consonant="z";
  4913. $1=_st(vowel)._isVowel();
  4914. $ctx1.sendIdx["isVowel"]=1;
  4915. self._assert_equals_($1,true);
  4916. $ctx1.sendIdx["assert:equals:"]=1;
  4917. self._assert_equals_(_st(consonant)._isVowel(),false);
  4918. return self}, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},globals.StringTest)})},
  4919. args: [],
  4920. 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",
  4921. messageSends: ["assert:equals:", "isVowel"],
  4922. referencedClasses: []
  4923. }),
  4924. globals.StringTest);
  4925. smalltalk.addMethod(
  4926. smalltalk.method({
  4927. selector: "testJoin",
  4928. protocol: 'tests',
  4929. fn: function (){
  4930. var self=this;
  4931. return smalltalk.withContext(function($ctx1) {
  4932. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  4933. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},globals.StringTest)})},
  4934. args: [],
  4935. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  4936. messageSends: ["assert:equals:", "join:"],
  4937. referencedClasses: []
  4938. }),
  4939. globals.StringTest);
  4940. smalltalk.addMethod(
  4941. smalltalk.method({
  4942. selector: "testRemoveAll",
  4943. protocol: 'tests',
  4944. fn: function (){
  4945. var self=this;
  4946. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  4947. return smalltalk.withContext(function($ctx1) {
  4948. self._should_raise_((function(){
  4949. return smalltalk.withContext(function($ctx2) {
  4950. return _st(self._collection())._removeAll();
  4951. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4952. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},globals.StringTest)})},
  4953. args: [],
  4954. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  4955. messageSends: ["should:raise:", "removeAll", "collection"],
  4956. referencedClasses: ["Error"]
  4957. }),
  4958. globals.StringTest);
  4959. smalltalk.addMethod(
  4960. smalltalk.method({
  4961. selector: "testReversed",
  4962. protocol: 'tests',
  4963. fn: function (){
  4964. var self=this;
  4965. return smalltalk.withContext(function($ctx1) {
  4966. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  4967. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{},globals.StringTest)})},
  4968. args: [],
  4969. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  4970. messageSends: ["assert:equals:", "reversed"],
  4971. referencedClasses: []
  4972. }),
  4973. globals.StringTest);
  4974. smalltalk.addMethod(
  4975. smalltalk.method({
  4976. selector: "testStreamContents",
  4977. protocol: 'tests',
  4978. fn: function (){
  4979. var self=this;
  4980. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  4981. return smalltalk.withContext(function($ctx1) {
  4982. var $1;
  4983. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  4984. return smalltalk.withContext(function($ctx2) {
  4985. _st(aStream)._nextPutAll_("hello");
  4986. $ctx2.sendIdx["nextPutAll:"]=1;
  4987. _st(aStream)._space();
  4988. $1=_st(aStream)._nextPutAll_("world");
  4989. return $1;
  4990. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)})})),"hello world");
  4991. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},globals.StringTest)})},
  4992. args: [],
  4993. 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'",
  4994. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  4995. referencedClasses: ["String"]
  4996. }),
  4997. globals.StringTest);
  4998. smalltalk.addMethod(
  4999. smalltalk.method({
  5000. selector: "testSubStrings",
  5001. protocol: 'tests',
  5002. fn: function (){
  5003. var self=this;
  5004. return smalltalk.withContext(function($ctx1) {
  5005. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  5006. return self}, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},globals.StringTest)})},
  5007. args: [],
  5008. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  5009. messageSends: ["assert:equals:", "subStrings:"],
  5010. referencedClasses: []
  5011. }),
  5012. globals.StringTest);
  5013. smalltalk.addMethod(
  5014. smalltalk.method({
  5015. selector: "testTrim",
  5016. protocol: 'tests',
  5017. fn: function (){
  5018. var self=this;
  5019. return smalltalk.withContext(function($ctx1) {
  5020. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  5021. $ctx1.sendIdx["assert:equals:"]=1;
  5022. self._assert_equals_("jackie "._trimRight(),"jackie");
  5023. return self}, function($ctx1) {$ctx1.fill(self,"testTrim",{},globals.StringTest)})},
  5024. args: [],
  5025. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  5026. messageSends: ["assert:equals:", "trimLeft", "trimRight"],
  5027. referencedClasses: []
  5028. }),
  5029. globals.StringTest);
  5030. smalltalk.addMethod(
  5031. smalltalk.method({
  5032. selector: "testValue",
  5033. protocol: 'tests',
  5034. fn: function (){
  5035. var self=this;
  5036. return smalltalk.withContext(function($ctx1) {
  5037. self._assert_equals_("asString"._value_((1)),"1");
  5038. $ctx1.sendIdx["assert:equals:"]=1;
  5039. self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  5040. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},globals.StringTest)})},
  5041. args: [],
  5042. source: "testValue\x0a\x0a\x09self assert: (#asString value: 1) equals: '1'.\x0a\x0a\x09\x22Which (since String and BlockClosure are now polymorphic) enables the nice idiom...\x22\x0a\x09self assert: (#(1 2 3) collect: #asString) equals: #('1' '2' '3')",
  5043. messageSends: ["assert:equals:", "value:", "collect:"],
  5044. referencedClasses: []
  5045. }),
  5046. globals.StringTest);
  5047. smalltalk.addMethod(
  5048. smalltalk.method({
  5049. selector: "collectionClass",
  5050. protocol: 'fixture',
  5051. fn: function (){
  5052. var self=this;
  5053. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  5054. return $String();
  5055. },
  5056. args: [],
  5057. source: "collectionClass\x0a\x09^ String",
  5058. messageSends: [],
  5059. referencedClasses: ["String"]
  5060. }),
  5061. globals.StringTest.klass);
  5062. smalltalk.addClass('SetTest', globals.CollectionTest, [], 'Kernel-Tests');
  5063. smalltalk.addMethod(
  5064. smalltalk.method({
  5065. selector: "collection",
  5066. protocol: 'fixture',
  5067. fn: function (){
  5068. var self=this;
  5069. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5070. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  5071. return smalltalk.withContext(function($ctx1) {
  5072. var $2,$3,$1;
  5073. $2=_st($Set())._new();
  5074. _st($2)._add_($Smalltalk());
  5075. $ctx1.sendIdx["add:"]=1;
  5076. _st($2)._add_(nil);
  5077. $ctx1.sendIdx["add:"]=2;
  5078. _st($2)._add_((3).__at((3)));
  5079. $ctx1.sendIdx["add:"]=3;
  5080. _st($2)._add_(false);
  5081. $3=_st($2)._yourself();
  5082. $1=$3;
  5083. return $1;
  5084. }, function($ctx1) {$ctx1.fill(self,"collection",{},globals.SetTest)})},
  5085. args: [],
  5086. source: "collection\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: false;\x0a\x09\x09yourself",
  5087. messageSends: ["add:", "new", "@", "yourself"],
  5088. referencedClasses: ["Set", "Smalltalk"]
  5089. }),
  5090. globals.SetTest);
  5091. smalltalk.addMethod(
  5092. smalltalk.method({
  5093. selector: "collectionOfPrintStrings",
  5094. protocol: 'fixture',
  5095. fn: function (){
  5096. var self=this;
  5097. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5098. return smalltalk.withContext(function($ctx1) {
  5099. var $2,$3,$1;
  5100. $2=_st($Set())._new();
  5101. _st($2)._add_("a SmalltalkImage");
  5102. $ctx1.sendIdx["add:"]=1;
  5103. _st($2)._add_("nil");
  5104. $ctx1.sendIdx["add:"]=2;
  5105. _st($2)._add_("3@3");
  5106. $ctx1.sendIdx["add:"]=3;
  5107. _st($2)._add_("false");
  5108. $3=_st($2)._yourself();
  5109. $1=$3;
  5110. return $1;
  5111. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},globals.SetTest)})},
  5112. args: [],
  5113. source: "collectionOfPrintStrings\x0a\x09^ Set new\x0a\x09\x09add: 'a SmalltalkImage';\x0a\x09\x09add: 'nil';\x0a\x09\x09add: '3@3';\x0a\x09\x09add: 'false';\x0a\x09\x09yourself",
  5114. messageSends: ["add:", "new", "yourself"],
  5115. referencedClasses: ["Set"]
  5116. }),
  5117. globals.SetTest);
  5118. smalltalk.addMethod(
  5119. smalltalk.method({
  5120. selector: "collectionSize",
  5121. protocol: 'fixture',
  5122. fn: function (){
  5123. var self=this;
  5124. return (4);
  5125. },
  5126. args: [],
  5127. source: "collectionSize\x0a\x09^ 4",
  5128. messageSends: [],
  5129. referencedClasses: []
  5130. }),
  5131. globals.SetTest);
  5132. smalltalk.addMethod(
  5133. smalltalk.method({
  5134. selector: "collectionWithDuplicates",
  5135. protocol: 'fixture',
  5136. fn: function (){
  5137. var self=this;
  5138. return smalltalk.withContext(function($ctx1) {
  5139. var $2,$3,$1;
  5140. $2=self._collection();
  5141. _st($2)._add_((0));
  5142. $3=_st($2)._yourself();
  5143. $1=$3;
  5144. return $1;
  5145. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},globals.SetTest)})},
  5146. args: [],
  5147. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  5148. messageSends: ["add:", "collection", "yourself"],
  5149. referencedClasses: []
  5150. }),
  5151. globals.SetTest);
  5152. smalltalk.addMethod(
  5153. smalltalk.method({
  5154. selector: "collectionWithNewValue",
  5155. protocol: 'fixture',
  5156. fn: function (){
  5157. var self=this;
  5158. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5159. function $Smalltalk(){return globals.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  5160. return smalltalk.withContext(function($ctx1) {
  5161. var $2,$3,$1;
  5162. $2=_st($Set())._new();
  5163. _st($2)._add_($Smalltalk());
  5164. $ctx1.sendIdx["add:"]=1;
  5165. _st($2)._add_(nil);
  5166. $ctx1.sendIdx["add:"]=2;
  5167. _st($2)._add_((3).__at((3)));
  5168. $ctx1.sendIdx["add:"]=3;
  5169. _st($2)._add_("N");
  5170. $ctx1.sendIdx["add:"]=4;
  5171. _st($2)._add_(false);
  5172. $3=_st($2)._yourself();
  5173. $1=$3;
  5174. return $1;
  5175. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},globals.SetTest)})},
  5176. args: [],
  5177. source: "collectionWithNewValue\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: 'N';\x0a\x09\x09add: false;\x0a\x09\x09yourself",
  5178. messageSends: ["add:", "new", "@", "yourself"],
  5179. referencedClasses: ["Set", "Smalltalk"]
  5180. }),
  5181. globals.SetTest);
  5182. smalltalk.addMethod(
  5183. smalltalk.method({
  5184. selector: "testAddAll",
  5185. protocol: 'tests',
  5186. fn: function (){
  5187. var self=this;
  5188. return smalltalk.withContext(function($ctx1) {
  5189. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  5190. ($ctx1.supercall = true, globals.SetTest.superclass.fn.prototype._testAddAll.apply(_st(self), []));
  5191. $ctx1.supercall = false;
  5192. $2=self._collection();
  5193. $ctx1.sendIdx["collection"]=1;
  5194. $3=$2;
  5195. $4=self._collection();
  5196. $ctx1.sendIdx["collection"]=2;
  5197. _st($3)._addAll_($4);
  5198. $ctx1.sendIdx["addAll:"]=1;
  5199. $5=_st($2)._yourself();
  5200. $ctx1.sendIdx["yourself"]=1;
  5201. $1=$5;
  5202. $6=self._collection();
  5203. $ctx1.sendIdx["collection"]=3;
  5204. self._assert_equals_($1,$6);
  5205. $ctx1.sendIdx["assert:equals:"]=1;
  5206. $8=self._collection();
  5207. $ctx1.sendIdx["collection"]=4;
  5208. $9=$8;
  5209. $10=self._collectionWithNewValue();
  5210. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5211. _st($9)._addAll_($10);
  5212. $ctx1.sendIdx["addAll:"]=2;
  5213. $11=_st($8)._yourself();
  5214. $ctx1.sendIdx["yourself"]=2;
  5215. $7=$11;
  5216. $12=self._collectionWithNewValue();
  5217. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5218. self._assert_equals_($7,$12);
  5219. $ctx1.sendIdx["assert:equals:"]=2;
  5220. $14=self._collectionWithNewValue();
  5221. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5222. _st($14)._addAll_(self._collection());
  5223. $15=_st($14)._yourself();
  5224. $13=$15;
  5225. self._assert_equals_($13,self._collectionWithNewValue());
  5226. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},globals.SetTest)})},
  5227. args: [],
  5228. 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",
  5229. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  5230. referencedClasses: []
  5231. }),
  5232. globals.SetTest);
  5233. smalltalk.addMethod(
  5234. smalltalk.method({
  5235. selector: "testAddRemove",
  5236. protocol: 'tests',
  5237. fn: function (){
  5238. var self=this;
  5239. var set;
  5240. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5241. return smalltalk.withContext(function($ctx1) {
  5242. var $1,$2;
  5243. set=_st($Set())._new();
  5244. self._assert_(_st(set)._isEmpty());
  5245. $ctx1.sendIdx["assert:"]=1;
  5246. _st(set)._add_((3));
  5247. $ctx1.sendIdx["add:"]=1;
  5248. $1=_st(set)._includes_((3));
  5249. $ctx1.sendIdx["includes:"]=1;
  5250. self._assert_($1);
  5251. $ctx1.sendIdx["assert:"]=2;
  5252. _st(set)._add_((5));
  5253. $2=_st(set)._includes_((5));
  5254. $ctx1.sendIdx["includes:"]=2;
  5255. self._assert_($2);
  5256. _st(set)._remove_((3));
  5257. self._deny_(_st(set)._includes_((3)));
  5258. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},globals.SetTest)})},
  5259. args: [],
  5260. 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)",
  5261. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  5262. referencedClasses: ["Set"]
  5263. }),
  5264. globals.SetTest);
  5265. smalltalk.addMethod(
  5266. smalltalk.method({
  5267. selector: "testAt",
  5268. protocol: 'tests',
  5269. fn: function (){
  5270. var self=this;
  5271. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5272. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5273. return smalltalk.withContext(function($ctx1) {
  5274. self._should_raise_((function(){
  5275. return smalltalk.withContext(function($ctx2) {
  5276. return _st(_st($Set())._new())._at_put_((1),(2));
  5277. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5278. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.SetTest)})},
  5279. args: [],
  5280. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  5281. messageSends: ["should:raise:", "at:put:", "new"],
  5282. referencedClasses: ["Set", "Error"]
  5283. }),
  5284. globals.SetTest);
  5285. smalltalk.addMethod(
  5286. smalltalk.method({
  5287. selector: "testCollect",
  5288. protocol: 'tests',
  5289. fn: function (){
  5290. var self=this;
  5291. return smalltalk.withContext(function($ctx1) {
  5292. var $2,$1;
  5293. ($ctx1.supercall = true, globals.SetTest.superclass.fn.prototype._testCollect.apply(_st(self), []));
  5294. $ctx1.supercall = false;
  5295. $2=[(5), (6), (8)]._asSet();
  5296. $ctx1.sendIdx["asSet"]=1;
  5297. $1=_st($2)._collect_((function(x){
  5298. return smalltalk.withContext(function($ctx2) {
  5299. return _st(x).__backslash_backslash((3));
  5300. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5301. self._assert_equals_($1,[(0), (2)]._asSet());
  5302. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},globals.SetTest)})},
  5303. args: [],
  5304. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  5305. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"],
  5306. referencedClasses: []
  5307. }),
  5308. globals.SetTest);
  5309. smalltalk.addMethod(
  5310. smalltalk.method({
  5311. selector: "testComma",
  5312. protocol: 'tests',
  5313. fn: function (){
  5314. var self=this;
  5315. return smalltalk.withContext(function($ctx1) {
  5316. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  5317. ($ctx1.supercall = true, globals.SetTest.superclass.fn.prototype._testComma.apply(_st(self), []));
  5318. $ctx1.supercall = false;
  5319. $2=self._collection();
  5320. $ctx1.sendIdx["collection"]=1;
  5321. $3=self._collection();
  5322. $ctx1.sendIdx["collection"]=2;
  5323. $1=_st($2).__comma($3);
  5324. $ctx1.sendIdx[","]=1;
  5325. $4=self._collection();
  5326. $ctx1.sendIdx["collection"]=3;
  5327. self._assert_equals_($1,$4);
  5328. $ctx1.sendIdx["assert:equals:"]=1;
  5329. $6=self._collection();
  5330. $ctx1.sendIdx["collection"]=4;
  5331. $7=self._collectionWithNewValue();
  5332. $ctx1.sendIdx["collectionWithNewValue"]=1;
  5333. $5=_st($6).__comma($7);
  5334. $ctx1.sendIdx[","]=2;
  5335. $8=self._collectionWithNewValue();
  5336. $ctx1.sendIdx["collectionWithNewValue"]=2;
  5337. self._assert_equals_($5,$8);
  5338. $ctx1.sendIdx["assert:equals:"]=2;
  5339. $10=self._collectionWithNewValue();
  5340. $ctx1.sendIdx["collectionWithNewValue"]=3;
  5341. $9=_st($10).__comma(self._collection());
  5342. self._assert_equals_($9,self._collectionWithNewValue());
  5343. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},globals.SetTest)})},
  5344. args: [],
  5345. 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",
  5346. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
  5347. referencedClasses: []
  5348. }),
  5349. globals.SetTest);
  5350. smalltalk.addMethod(
  5351. smalltalk.method({
  5352. selector: "testComparing",
  5353. protocol: 'tests',
  5354. fn: function (){
  5355. var self=this;
  5356. return smalltalk.withContext(function($ctx1) {
  5357. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  5358. $1=[(0), (2)]._asSet();
  5359. $ctx1.sendIdx["asSet"]=1;
  5360. $2=[(0), (2)]._asSet();
  5361. $ctx1.sendIdx["asSet"]=2;
  5362. self._assert_equals_($1,$2);
  5363. $ctx1.sendIdx["assert:equals:"]=1;
  5364. $3=[(2), (0)]._asSet();
  5365. $ctx1.sendIdx["asSet"]=3;
  5366. $4=[(0), (2)]._asSet();
  5367. $ctx1.sendIdx["asSet"]=4;
  5368. self._assert_equals_($3,$4);
  5369. $6=[(0), (2), (3)]._asSet();
  5370. $ctx1.sendIdx["asSet"]=5;
  5371. $7=[(0), (2)]._asSet();
  5372. $ctx1.sendIdx["asSet"]=6;
  5373. $5=_st($6).__eq($7);
  5374. $ctx1.sendIdx["="]=1;
  5375. self._deny_($5);
  5376. $ctx1.sendIdx["deny:"]=1;
  5377. $9=[(1), (2)]._asSet();
  5378. $ctx1.sendIdx["asSet"]=7;
  5379. $8=_st($9).__eq([(0), (2)]._asSet());
  5380. self._deny_($8);
  5381. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},globals.SetTest)})},
  5382. args: [],
  5383. 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",
  5384. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  5385. referencedClasses: []
  5386. }),
  5387. globals.SetTest);
  5388. smalltalk.addMethod(
  5389. smalltalk.method({
  5390. selector: "testPrintString",
  5391. protocol: 'tests',
  5392. fn: function (){
  5393. var self=this;
  5394. var set;
  5395. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5396. return smalltalk.withContext(function($ctx1) {
  5397. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  5398. set=_st($Set())._new();
  5399. $1=_st(set)._printString();
  5400. $ctx1.sendIdx["printString"]=1;
  5401. self._assert_equals_($1,"a Set ()");
  5402. $ctx1.sendIdx["assert:equals:"]=1;
  5403. $2=set;
  5404. _st($2)._add_((1));
  5405. $ctx1.sendIdx["add:"]=1;
  5406. $3=_st($2)._add_((3));
  5407. $ctx1.sendIdx["add:"]=2;
  5408. $4=_st(set)._printString();
  5409. $ctx1.sendIdx["printString"]=2;
  5410. self._assert_equals_($4,"a Set (1 3)");
  5411. $ctx1.sendIdx["assert:equals:"]=2;
  5412. _st(set)._add_("foo");
  5413. $ctx1.sendIdx["add:"]=3;
  5414. $5=_st(set)._printString();
  5415. $ctx1.sendIdx["printString"]=3;
  5416. self._assert_equals_($5,"a Set (1 3 'foo')");
  5417. $ctx1.sendIdx["assert:equals:"]=3;
  5418. $6=set;
  5419. _st($6)._remove_((1));
  5420. $ctx1.sendIdx["remove:"]=1;
  5421. $7=_st($6)._remove_((3));
  5422. $8=_st(set)._printString();
  5423. $ctx1.sendIdx["printString"]=4;
  5424. self._assert_equals_($8,"a Set ('foo')");
  5425. $ctx1.sendIdx["assert:equals:"]=4;
  5426. _st(set)._add_((3));
  5427. $ctx1.sendIdx["add:"]=4;
  5428. $9=_st(set)._printString();
  5429. $ctx1.sendIdx["printString"]=5;
  5430. self._assert_equals_($9,"a Set (3 'foo')");
  5431. $ctx1.sendIdx["assert:equals:"]=5;
  5432. _st(set)._add_((3));
  5433. self._assert_equals_(_st(set)._printString(),"a Set (3 'foo')");
  5434. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},globals.SetTest)})},
  5435. args: [],
  5436. source: "testPrintString\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09self assert: set printString equals: 'a Set ()'.\x0a\x09set add: 1; add: 3.\x0a\x09self assert: set printString equals: 'a Set (1 3)'.\x0a\x09set add: 'foo'.\x0a\x09self assert: set printString equals: 'a Set (1 3 ''foo'')'.\x0a\x09set remove: 1; remove: 3.\x0a\x09self assert: set printString equals: 'a Set (''foo'')'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (3 ''foo'')'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (3 ''foo'')'",
  5437. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  5438. referencedClasses: ["Set"]
  5439. }),
  5440. globals.SetTest);
  5441. smalltalk.addMethod(
  5442. smalltalk.method({
  5443. selector: "testUnboxedObjects",
  5444. protocol: 'tests',
  5445. fn: function (){
  5446. var self=this;
  5447. return smalltalk.withContext(function($ctx1) {
  5448. var $4,$3,$2,$1;
  5449. $4="foo"._yourself();
  5450. $ctx1.sendIdx["yourself"]=1;
  5451. $3=[$4,"foo"._yourself()];
  5452. $2=_st($3)._asSet();
  5453. $1=_st($2)._asArray();
  5454. self._assert_equals_($1,["foo"]);
  5455. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},globals.SetTest)})},
  5456. args: [],
  5457. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  5458. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  5459. referencedClasses: []
  5460. }),
  5461. globals.SetTest);
  5462. smalltalk.addMethod(
  5463. smalltalk.method({
  5464. selector: "testUnicity",
  5465. protocol: 'tests',
  5466. fn: function (){
  5467. var self=this;
  5468. var set;
  5469. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5470. return smalltalk.withContext(function($ctx1) {
  5471. var $1;
  5472. set=_st($Set())._new();
  5473. _st(set)._add_((21));
  5474. $ctx1.sendIdx["add:"]=1;
  5475. _st(set)._add_("hello");
  5476. $ctx1.sendIdx["add:"]=2;
  5477. _st(set)._add_((21));
  5478. $ctx1.sendIdx["add:"]=3;
  5479. $1=_st(set)._size();
  5480. $ctx1.sendIdx["size"]=1;
  5481. self._assert_equals_($1,(2));
  5482. $ctx1.sendIdx["assert:equals:"]=1;
  5483. _st(set)._add_("hello");
  5484. self._assert_equals_(_st(set)._size(),(2));
  5485. $ctx1.sendIdx["assert:equals:"]=2;
  5486. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  5487. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},globals.SetTest)})},
  5488. args: [],
  5489. 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')",
  5490. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  5491. referencedClasses: ["Set"]
  5492. }),
  5493. globals.SetTest);
  5494. smalltalk.addMethod(
  5495. smalltalk.method({
  5496. selector: "collectionClass",
  5497. protocol: 'fixture',
  5498. fn: function (){
  5499. var self=this;
  5500. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  5501. return $Set();
  5502. },
  5503. args: [],
  5504. source: "collectionClass\x0a\x09^ Set",
  5505. messageSends: [],
  5506. referencedClasses: ["Set"]
  5507. }),
  5508. globals.SetTest.klass);
  5509. smalltalk.addClass('ConsoleTranscriptTest', globals.TestCase, [], 'Kernel-Tests');
  5510. smalltalk.addMethod(
  5511. smalltalk.method({
  5512. selector: "testShow",
  5513. protocol: 'tests',
  5514. fn: function (){
  5515. var self=this;
  5516. var originalTranscript;
  5517. function $Transcript(){return globals.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  5518. function $ConsoleTranscript(){return globals.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  5519. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  5520. return smalltalk.withContext(function($ctx1) {
  5521. originalTranscript=_st($Transcript())._current();
  5522. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  5523. $ctx1.sendIdx["register:"]=1;
  5524. self._shouldnt_raise_((function(){
  5525. return smalltalk.withContext(function($ctx2) {
  5526. return _st($Transcript())._show_("Hello console!");
  5527. $ctx2.sendIdx["show:"]=1;
  5528. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  5529. $ctx1.sendIdx["shouldnt:raise:"]=1;
  5530. self._shouldnt_raise_((function(){
  5531. return smalltalk.withContext(function($ctx2) {
  5532. return _st($Transcript())._show_(console);
  5533. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  5534. _st($Transcript())._register_(originalTranscript);
  5535. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},globals.ConsoleTranscriptTest)})},
  5536. args: [],
  5537. 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.",
  5538. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  5539. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  5540. }),
  5541. globals.ConsoleTranscriptTest);
  5542. smalltalk.addClass('JSObjectProxyTest', globals.TestCase, [], 'Kernel-Tests');
  5543. smalltalk.addMethod(
  5544. smalltalk.method({
  5545. selector: "jsNull",
  5546. protocol: 'accessing',
  5547. fn: function (){
  5548. var self=this;
  5549. return smalltalk.withContext(function($ctx1) {
  5550. return null;
  5551. return self}, function($ctx1) {$ctx1.fill(self,"jsNull",{},globals.JSObjectProxyTest)})},
  5552. args: [],
  5553. source: "jsNull\x0a\x09<return null>",
  5554. messageSends: [],
  5555. referencedClasses: []
  5556. }),
  5557. globals.JSObjectProxyTest);
  5558. smalltalk.addMethod(
  5559. smalltalk.method({
  5560. selector: "jsObject",
  5561. protocol: 'accessing',
  5562. fn: function (){
  5563. var self=this;
  5564. return smalltalk.withContext(function($ctx1) {
  5565. return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  5566. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},globals.JSObjectProxyTest)})},
  5567. args: [],
  5568. source: "jsObject\x0a\x09<return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  5569. messageSends: [],
  5570. referencedClasses: []
  5571. }),
  5572. globals.JSObjectProxyTest);
  5573. smalltalk.addMethod(
  5574. smalltalk.method({
  5575. selector: "jsUndefined",
  5576. protocol: 'accessing',
  5577. fn: function (){
  5578. var self=this;
  5579. return smalltalk.withContext(function($ctx1) {
  5580. return;
  5581. return self}, function($ctx1) {$ctx1.fill(self,"jsUndefined",{},globals.JSObjectProxyTest)})},
  5582. args: [],
  5583. source: "jsUndefined\x0a\x09<return>",
  5584. messageSends: [],
  5585. referencedClasses: []
  5586. }),
  5587. globals.JSObjectProxyTest);
  5588. smalltalk.addMethod(
  5589. smalltalk.method({
  5590. selector: "testAtIfAbsent",
  5591. protocol: 'tests',
  5592. fn: function (){
  5593. var self=this;
  5594. var testObject;
  5595. return smalltalk.withContext(function($ctx1) {
  5596. var $1,$2,$3;
  5597. testObject=self._jsObject();
  5598. $1=_st(testObject)._at_ifAbsent_("abc",(function(){
  5599. return "Property does not exist";
  5600. }));
  5601. $ctx1.sendIdx["at:ifAbsent:"]=1;
  5602. self._assert_equals_($1,"Property does not exist");
  5603. $ctx1.sendIdx["assert:equals:"]=1;
  5604. $2=_st(testObject)._at_ifAbsent_("e",(function(){
  5605. return "Property does not exist";
  5606. }));
  5607. $ctx1.sendIdx["at:ifAbsent:"]=2;
  5608. self._assert_equals_($2,nil);
  5609. $ctx1.sendIdx["assert:equals:"]=2;
  5610. $3=_st(testObject)._at_ifAbsent_("a",(function(){
  5611. return "Property does not exist";
  5612. }));
  5613. $ctx1.sendIdx["at:ifAbsent:"]=3;
  5614. self._assert_equals_($3,(1));
  5615. $ctx1.sendIdx["assert:equals:"]=3;
  5616. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  5617. return "Property does not exist";
  5618. })),nil);
  5619. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},globals.JSObjectProxyTest)})},
  5620. args: [],
  5621. 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.",
  5622. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  5623. referencedClasses: []
  5624. }),
  5625. globals.JSObjectProxyTest);
  5626. smalltalk.addMethod(
  5627. smalltalk.method({
  5628. selector: "testAtIfPresent",
  5629. protocol: 'tests',
  5630. fn: function (){
  5631. var self=this;
  5632. var testObject;
  5633. return smalltalk.withContext(function($ctx1) {
  5634. var $2,$1,$4,$3,$6,$5;
  5635. testObject=self._jsObject();
  5636. $1=_st(testObject)._at_ifPresent_("abc",(function(x){
  5637. return smalltalk.withContext(function($ctx2) {
  5638. $2=_st(x)._asString();
  5639. $ctx2.sendIdx["asString"]=1;
  5640. return "hello ".__comma($2);
  5641. $ctx2.sendIdx[","]=1;
  5642. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  5643. $ctx1.sendIdx["at:ifPresent:"]=1;
  5644. self._assert_equals_($1,nil);
  5645. $ctx1.sendIdx["assert:equals:"]=1;
  5646. $3=_st(testObject)._at_ifPresent_("e",(function(x){
  5647. return smalltalk.withContext(function($ctx2) {
  5648. $4=_st(x)._asString();
  5649. $ctx2.sendIdx["asString"]=2;
  5650. return "hello ".__comma($4);
  5651. $ctx2.sendIdx[","]=2;
  5652. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}));
  5653. $ctx1.sendIdx["at:ifPresent:"]=2;
  5654. self._assert_equals_($3,"hello nil");
  5655. $ctx1.sendIdx["assert:equals:"]=2;
  5656. $5=_st(testObject)._at_ifPresent_("a",(function(x){
  5657. return smalltalk.withContext(function($ctx2) {
  5658. $6=_st(x)._asString();
  5659. $ctx2.sendIdx["asString"]=3;
  5660. return "hello ".__comma($6);
  5661. $ctx2.sendIdx[","]=3;
  5662. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}));
  5663. $ctx1.sendIdx["at:ifPresent:"]=3;
  5664. self._assert_equals_($5,"hello 1");
  5665. $ctx1.sendIdx["assert:equals:"]=3;
  5666. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  5667. return smalltalk.withContext(function($ctx2) {
  5668. return "hello ".__comma(_st(x)._asString());
  5669. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)})})),"hello nil");
  5670. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},globals.JSObjectProxyTest)})},
  5671. args: [],
  5672. 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'.",
  5673. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  5674. referencedClasses: []
  5675. }),
  5676. globals.JSObjectProxyTest);
  5677. smalltalk.addMethod(
  5678. smalltalk.method({
  5679. selector: "testAtIfPresentIfAbsent",
  5680. protocol: 'tests',
  5681. fn: function (){
  5682. var self=this;
  5683. var testObject;
  5684. return smalltalk.withContext(function($ctx1) {
  5685. var $2,$1,$4,$3,$6,$5;
  5686. testObject=self._jsObject();
  5687. $1=_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  5688. return smalltalk.withContext(function($ctx2) {
  5689. $2=_st(x)._asString();
  5690. $ctx2.sendIdx["asString"]=1;
  5691. return "hello ".__comma($2);
  5692. $ctx2.sendIdx[","]=1;
  5693. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}),(function(){
  5694. return "not present";
  5695. }));
  5696. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  5697. self._assert_equals_($1,"not present");
  5698. $ctx1.sendIdx["assert:equals:"]=1;
  5699. $3=_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  5700. return smalltalk.withContext(function($ctx2) {
  5701. $4=_st(x)._asString();
  5702. $ctx2.sendIdx["asString"]=2;
  5703. return "hello ".__comma($4);
  5704. $ctx2.sendIdx[","]=2;
  5705. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}),(function(){
  5706. return "not present";
  5707. }));
  5708. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  5709. self._assert_equals_($3,"hello nil");
  5710. $ctx1.sendIdx["assert:equals:"]=2;
  5711. $5=_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  5712. return smalltalk.withContext(function($ctx2) {
  5713. $6=_st(x)._asString();
  5714. $ctx2.sendIdx["asString"]=3;
  5715. return "hello ".__comma($6);
  5716. $ctx2.sendIdx[","]=3;
  5717. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)})}),(function(){
  5718. return "not present";
  5719. }));
  5720. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  5721. self._assert_equals_($5,"hello 1");
  5722. $ctx1.sendIdx["assert:equals:"]=3;
  5723. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  5724. return smalltalk.withContext(function($ctx2) {
  5725. return "hello ".__comma(_st(x)._asString());
  5726. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)})}),(function(){
  5727. return "not present";
  5728. })),"hello nil");
  5729. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},globals.JSObjectProxyTest)})},
  5730. args: [],
  5731. 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'.",
  5732. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  5733. referencedClasses: []
  5734. }),
  5735. globals.JSObjectProxyTest);
  5736. smalltalk.addMethod(
  5737. smalltalk.method({
  5738. selector: "testAtPut",
  5739. protocol: 'tests',
  5740. fn: function (){
  5741. var self=this;
  5742. var testObject;
  5743. return smalltalk.withContext(function($ctx1) {
  5744. var $2,$1;
  5745. testObject=self._jsObject();
  5746. $2=_st(testObject)._at_("abc");
  5747. $ctx1.sendIdx["at:"]=1;
  5748. $1=_st($2).__tild_eq("xyz");
  5749. self._assert_($1);
  5750. self._assert_equals_(_st(testObject)._at_put_("abc","xyz"),"xyz");
  5751. $ctx1.sendIdx["assert:equals:"]=1;
  5752. self._assert_equals_(_st(testObject)._at_("abc"),"xyz");
  5753. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},globals.JSObjectProxyTest)})},
  5754. args: [],
  5755. 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'",
  5756. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"],
  5757. referencedClasses: []
  5758. }),
  5759. globals.JSObjectProxyTest);
  5760. smalltalk.addMethod(
  5761. smalltalk.method({
  5762. selector: "testComparison",
  5763. protocol: 'tests',
  5764. fn: function (){
  5765. var self=this;
  5766. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  5767. return smalltalk.withContext(function($ctx1) {
  5768. var $1,$2;
  5769. self._assert_equals_(_st([console,(2)])._indexOf_(console),(1));
  5770. $1=_st(console).__eq(console);
  5771. $ctx1.sendIdx["="]=1;
  5772. self._assert_($1);
  5773. $2=_st(console).__eq(_st($Object())._new());
  5774. $ctx1.sendIdx["="]=2;
  5775. self._deny_($2);
  5776. $ctx1.sendIdx["deny:"]=1;
  5777. self._deny_(_st(console).__eq(self._jsObject()));
  5778. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.JSObjectProxyTest)})},
  5779. args: [],
  5780. source: "testComparison\x0a\x09self assert: ({ console. 2 } indexOf: console) equals: 1.\x0a\x09self assert: console = console.\x0a\x09self deny: console = Object new.\x0a\x09self deny: console = self jsObject",
  5781. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"],
  5782. referencedClasses: ["Object"]
  5783. }),
  5784. globals.JSObjectProxyTest);
  5785. smalltalk.addMethod(
  5786. smalltalk.method({
  5787. selector: "testDNU",
  5788. protocol: 'tests',
  5789. fn: function (){
  5790. var self=this;
  5791. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5792. return smalltalk.withContext(function($ctx1) {
  5793. self._should_raise_((function(){
  5794. return smalltalk.withContext(function($ctx2) {
  5795. return _st(self._jsObject())._foo();
  5796. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5797. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},globals.JSObjectProxyTest)})},
  5798. args: [],
  5799. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  5800. messageSends: ["should:raise:", "foo", "jsObject"],
  5801. referencedClasses: ["MessageNotUnderstood"]
  5802. }),
  5803. globals.JSObjectProxyTest);
  5804. smalltalk.addMethod(
  5805. smalltalk.method({
  5806. selector: "testMessageSend",
  5807. protocol: 'tests',
  5808. fn: function (){
  5809. var self=this;
  5810. return smalltalk.withContext(function($ctx1) {
  5811. var $2,$1,$4,$3;
  5812. $2=self._jsObject();
  5813. $ctx1.sendIdx["jsObject"]=1;
  5814. $1=_st($2)._a();
  5815. self._assert_equals_($1,(1));
  5816. $ctx1.sendIdx["assert:equals:"]=1;
  5817. $4=self._jsObject();
  5818. $ctx1.sendIdx["jsObject"]=2;
  5819. $3=_st($4)._b();
  5820. self._assert_equals_($3,(2));
  5821. $ctx1.sendIdx["assert:equals:"]=2;
  5822. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  5823. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},globals.JSObjectProxyTest)})},
  5824. args: [],
  5825. 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",
  5826. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  5827. referencedClasses: []
  5828. }),
  5829. globals.JSObjectProxyTest);
  5830. smalltalk.addMethod(
  5831. smalltalk.method({
  5832. selector: "testMethodWithArguments",
  5833. protocol: 'tests',
  5834. fn: function (){
  5835. var self=this;
  5836. return smalltalk.withContext(function($ctx1) {
  5837. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  5838. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},globals.JSObjectProxyTest)})},
  5839. args: [],
  5840. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  5841. messageSends: ["assert:equals:", "c:", "jsObject"],
  5842. referencedClasses: []
  5843. }),
  5844. globals.JSObjectProxyTest);
  5845. smalltalk.addMethod(
  5846. smalltalk.method({
  5847. selector: "testPrinting",
  5848. protocol: 'tests',
  5849. fn: function (){
  5850. var self=this;
  5851. return smalltalk.withContext(function($ctx1) {
  5852. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  5853. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},globals.JSObjectProxyTest)})},
  5854. args: [],
  5855. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  5856. messageSends: ["assert:equals:", "printString", "jsObject"],
  5857. referencedClasses: []
  5858. }),
  5859. globals.JSObjectProxyTest);
  5860. smalltalk.addMethod(
  5861. smalltalk.method({
  5862. selector: "testPropertyThatReturnsEmptyString",
  5863. protocol: 'tests',
  5864. fn: function (){
  5865. var self=this;
  5866. var object;
  5867. return smalltalk.withContext(function($ctx1) {
  5868. var $1;
  5869. object=self._jsObject();
  5870. $1=_st(object)._d();
  5871. $ctx1.sendIdx["d"]=1;
  5872. self._assert_equals_($1,"");
  5873. $ctx1.sendIdx["assert:equals:"]=1;
  5874. _st(object)._d_("hello");
  5875. self._assert_equals_(_st(object)._d(),"hello");
  5876. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},globals.JSObjectProxyTest)})},
  5877. args: [],
  5878. 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'",
  5879. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  5880. referencedClasses: []
  5881. }),
  5882. globals.JSObjectProxyTest);
  5883. smalltalk.addMethod(
  5884. smalltalk.method({
  5885. selector: "testPropertyThatReturnsUndefined",
  5886. protocol: 'tests',
  5887. fn: function (){
  5888. var self=this;
  5889. var object;
  5890. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5891. return smalltalk.withContext(function($ctx1) {
  5892. object=self._jsObject();
  5893. self._shouldnt_raise_((function(){
  5894. return smalltalk.withContext(function($ctx2) {
  5895. return _st(object)._e();
  5896. $ctx2.sendIdx["e"]=1;
  5897. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5898. self._assert_(_st(_st(object)._e())._isNil());
  5899. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},globals.JSObjectProxyTest)})},
  5900. args: [],
  5901. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  5902. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  5903. referencedClasses: ["MessageNotUnderstood"]
  5904. }),
  5905. globals.JSObjectProxyTest);
  5906. smalltalk.addMethod(
  5907. smalltalk.method({
  5908. selector: "testSetPropertyWithFalsyValue",
  5909. protocol: 'tests',
  5910. fn: function (){
  5911. var self=this;
  5912. var jsObject;
  5913. return smalltalk.withContext(function($ctx1) {
  5914. var $1,$2,$3,$4,$5;
  5915. jsObject=self._jsObject();
  5916. $1=_st(jsObject)._a();
  5917. $ctx1.sendIdx["a"]=1;
  5918. self._assert_equals_($1,(1));
  5919. $ctx1.sendIdx["assert:equals:"]=1;
  5920. _st(jsObject)._a_(self._jsNull());
  5921. $ctx1.sendIdx["a:"]=1;
  5922. $2=_st(jsObject)._a();
  5923. $ctx1.sendIdx["a"]=2;
  5924. self._assert_equals_($2,nil);
  5925. $ctx1.sendIdx["assert:equals:"]=2;
  5926. _st(jsObject)._a_((0));
  5927. $ctx1.sendIdx["a:"]=2;
  5928. $3=_st(jsObject)._a();
  5929. $ctx1.sendIdx["a"]=3;
  5930. self._assert_equals_($3,(0));
  5931. $ctx1.sendIdx["assert:equals:"]=3;
  5932. _st(jsObject)._a_(self._jsUndefined());
  5933. $ctx1.sendIdx["a:"]=3;
  5934. $4=_st(jsObject)._a();
  5935. $ctx1.sendIdx["a"]=4;
  5936. self._assert_equals_($4,nil);
  5937. $ctx1.sendIdx["assert:equals:"]=4;
  5938. _st(jsObject)._a_("");
  5939. $ctx1.sendIdx["a:"]=4;
  5940. $5=_st(jsObject)._a();
  5941. $ctx1.sendIdx["a"]=5;
  5942. self._assert_equals_($5,"");
  5943. $ctx1.sendIdx["assert:equals:"]=5;
  5944. _st(jsObject)._a_(false);
  5945. self._assert_equals_(_st(jsObject)._a(),false);
  5946. return self}, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject},globals.JSObjectProxyTest)})},
  5947. args: [],
  5948. source: "testSetPropertyWithFalsyValue\x0a\x09| jsObject |\x0a\x09jsObject := self jsObject.\x0a\x09self assert: (jsObject a) equals: 1.\x0a\x0a\x09jsObject a: self jsNull.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: 0.\x0a\x09self assert: (jsObject a) equals: 0.\x0a\x09jsObject a: self jsUndefined.\x0a\x09self assert: (jsObject a) equals: nil.\x0a\x09jsObject a: ''.\x0a\x09self assert: (jsObject a) equals: ''.\x0a\x09jsObject a: false.\x0a\x09self assert: (jsObject a) equals: false",
  5949. messageSends: ["jsObject", "assert:equals:", "a", "a:", "jsNull", "jsUndefined"],
  5950. referencedClasses: []
  5951. }),
  5952. globals.JSObjectProxyTest);
  5953. smalltalk.addMethod(
  5954. smalltalk.method({
  5955. selector: "testValue",
  5956. protocol: 'tests',
  5957. fn: function (){
  5958. var self=this;
  5959. var testObject;
  5960. return smalltalk.withContext(function($ctx1) {
  5961. testObject=self._jsObject();
  5962. _st(testObject)._at_put_("value","aValue");
  5963. self._assert_equals_(_st(testObject)._value(),"aValue");
  5964. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},globals.JSObjectProxyTest)})},
  5965. args: [],
  5966. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  5967. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"],
  5968. referencedClasses: []
  5969. }),
  5970. globals.JSObjectProxyTest);
  5971. smalltalk.addMethod(
  5972. smalltalk.method({
  5973. selector: "testYourself",
  5974. protocol: 'tests',
  5975. fn: function (){
  5976. var self=this;
  5977. var object;
  5978. return smalltalk.withContext(function($ctx1) {
  5979. var $1,$2;
  5980. $1=self._jsObject();
  5981. _st($1)._d_("test");
  5982. $2=_st($1)._yourself();
  5983. object=$2;
  5984. self._assert_equals_(_st(object)._d(),"test");
  5985. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},globals.JSObjectProxyTest)})},
  5986. args: [],
  5987. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  5988. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  5989. referencedClasses: []
  5990. }),
  5991. globals.JSObjectProxyTest);
  5992. smalltalk.addClass('JavaScriptExceptionTest', globals.TestCase, [], 'Kernel-Tests');
  5993. smalltalk.addMethod(
  5994. smalltalk.method({
  5995. selector: "testCatchingException",
  5996. protocol: 'tests',
  5997. fn: function (){
  5998. var self=this;
  5999. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  6000. return smalltalk.withContext(function($ctx1) {
  6001. _st((function(){
  6002. return smalltalk.withContext(function($ctx2) {
  6003. return self._throwException();
  6004. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  6005. return smalltalk.withContext(function($ctx2) {
  6006. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  6007. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  6008. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},globals.JavaScriptExceptionTest)})},
  6009. args: [],
  6010. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  6011. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"],
  6012. referencedClasses: ["Error"]
  6013. }),
  6014. globals.JavaScriptExceptionTest);
  6015. smalltalk.addMethod(
  6016. smalltalk.method({
  6017. selector: "testRaisingException",
  6018. protocol: 'tests',
  6019. fn: function (){
  6020. var self=this;
  6021. function $JavaScriptException(){return globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  6022. return smalltalk.withContext(function($ctx1) {
  6023. self._should_raise_((function(){
  6024. return smalltalk.withContext(function($ctx2) {
  6025. return self._throwException();
  6026. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$JavaScriptException());
  6027. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},globals.JavaScriptExceptionTest)})},
  6028. args: [],
  6029. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  6030. messageSends: ["should:raise:", "throwException"],
  6031. referencedClasses: ["JavaScriptException"]
  6032. }),
  6033. globals.JavaScriptExceptionTest);
  6034. smalltalk.addMethod(
  6035. smalltalk.method({
  6036. selector: "throwException",
  6037. protocol: 'helpers',
  6038. fn: function (){
  6039. var self=this;
  6040. return smalltalk.withContext(function($ctx1) {
  6041. throw 'test';
  6042. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},globals.JavaScriptExceptionTest)})},
  6043. args: [],
  6044. source: "throwException\x0a\x09<throw 'test'>",
  6045. messageSends: [],
  6046. referencedClasses: []
  6047. }),
  6048. globals.JavaScriptExceptionTest);
  6049. smalltalk.addClass('MessageSendTest', globals.TestCase, [], 'Kernel-Tests');
  6050. smalltalk.addMethod(
  6051. smalltalk.method({
  6052. selector: "testValue",
  6053. protocol: 'tests',
  6054. fn: function (){
  6055. var self=this;
  6056. var messageSend;
  6057. function $MessageSend(){return globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  6058. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  6059. return smalltalk.withContext(function($ctx1) {
  6060. var $1,$2;
  6061. $1=_st($MessageSend())._new();
  6062. $ctx1.sendIdx["new"]=1;
  6063. _st($1)._receiver_(_st($Object())._new());
  6064. _st($1)._selector_("asString");
  6065. $2=_st($1)._yourself();
  6066. messageSend=$2;
  6067. self._assert_equals_(_st(messageSend)._value(),"an Object");
  6068. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},globals.MessageSendTest)})},
  6069. args: [],
  6070. 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'",
  6071. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  6072. referencedClasses: ["MessageSend", "Object"]
  6073. }),
  6074. globals.MessageSendTest);
  6075. smalltalk.addMethod(
  6076. smalltalk.method({
  6077. selector: "testValueWithArguments",
  6078. protocol: 'tests',
  6079. fn: function (){
  6080. var self=this;
  6081. var messageSend;
  6082. function $MessageSend(){return globals.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  6083. return smalltalk.withContext(function($ctx1) {
  6084. var $1,$2;
  6085. $1=_st($MessageSend())._new();
  6086. _st($1)._receiver_((2));
  6087. _st($1)._selector_("+");
  6088. $2=_st($1)._yourself();
  6089. messageSend=$2;
  6090. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  6091. $ctx1.sendIdx["assert:equals:"]=1;
  6092. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  6093. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},globals.MessageSendTest)})},
  6094. args: [],
  6095. 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",
  6096. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  6097. referencedClasses: ["MessageSend"]
  6098. }),
  6099. globals.MessageSendTest);
  6100. smalltalk.addClass('MethodInheritanceTest', globals.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  6101. smalltalk.addMethod(
  6102. smalltalk.method({
  6103. selector: "codeGeneratorClass",
  6104. protocol: 'accessing',
  6105. fn: function (){
  6106. var self=this;
  6107. function $CodeGenerator(){return globals.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  6108. return $CodeGenerator();
  6109. },
  6110. args: [],
  6111. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  6112. messageSends: [],
  6113. referencedClasses: ["CodeGenerator"]
  6114. }),
  6115. globals.MethodInheritanceTest);
  6116. smalltalk.addMethod(
  6117. smalltalk.method({
  6118. selector: "compiler",
  6119. protocol: 'factory',
  6120. fn: function (){
  6121. var self=this;
  6122. function $Compiler(){return globals.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  6123. return smalltalk.withContext(function($ctx1) {
  6124. var $2,$3,$1;
  6125. $2=_st($Compiler())._new();
  6126. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  6127. $3=_st($2)._yourself();
  6128. $1=$3;
  6129. return $1;
  6130. }, function($ctx1) {$ctx1.fill(self,"compiler",{},globals.MethodInheritanceTest)})},
  6131. args: [],
  6132. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  6133. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  6134. referencedClasses: ["Compiler"]
  6135. }),
  6136. globals.MethodInheritanceTest);
  6137. smalltalk.addMethod(
  6138. smalltalk.method({
  6139. selector: "deinstallBottom",
  6140. protocol: 'testing',
  6141. fn: function (){
  6142. var self=this;
  6143. return smalltalk.withContext(function($ctx1) {
  6144. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  6145. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},globals.MethodInheritanceTest)})},
  6146. args: [],
  6147. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  6148. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  6149. referencedClasses: []
  6150. }),
  6151. globals.MethodInheritanceTest);
  6152. smalltalk.addMethod(
  6153. smalltalk.method({
  6154. selector: "deinstallMiddle",
  6155. protocol: 'testing',
  6156. fn: function (){
  6157. var self=this;
  6158. return smalltalk.withContext(function($ctx1) {
  6159. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  6160. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},globals.MethodInheritanceTest)})},
  6161. args: [],
  6162. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  6163. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  6164. referencedClasses: []
  6165. }),
  6166. globals.MethodInheritanceTest);
  6167. smalltalk.addMethod(
  6168. smalltalk.method({
  6169. selector: "deinstallTop",
  6170. protocol: 'testing',
  6171. fn: function (){
  6172. var self=this;
  6173. return smalltalk.withContext(function($ctx1) {
  6174. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  6175. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},globals.MethodInheritanceTest)})},
  6176. args: [],
  6177. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  6178. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  6179. referencedClasses: []
  6180. }),
  6181. globals.MethodInheritanceTest);
  6182. smalltalk.addMethod(
  6183. smalltalk.method({
  6184. selector: "installBottom:",
  6185. protocol: 'testing',
  6186. fn: function (aString){
  6187. var self=this;
  6188. return smalltalk.withContext(function($ctx1) {
  6189. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  6190. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},globals.MethodInheritanceTest)})},
  6191. args: ["aString"],
  6192. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  6193. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"],
  6194. referencedClasses: []
  6195. }),
  6196. globals.MethodInheritanceTest);
  6197. smalltalk.addMethod(
  6198. smalltalk.method({
  6199. selector: "installMiddle:",
  6200. protocol: 'testing',
  6201. fn: function (aString){
  6202. var self=this;
  6203. return smalltalk.withContext(function($ctx1) {
  6204. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  6205. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},globals.MethodInheritanceTest)})},
  6206. args: ["aString"],
  6207. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  6208. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"],
  6209. referencedClasses: []
  6210. }),
  6211. globals.MethodInheritanceTest);
  6212. smalltalk.addMethod(
  6213. smalltalk.method({
  6214. selector: "installTop:",
  6215. protocol: 'testing',
  6216. fn: function (aString){
  6217. var self=this;
  6218. return smalltalk.withContext(function($ctx1) {
  6219. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  6220. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},globals.MethodInheritanceTest)})},
  6221. args: ["aString"],
  6222. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  6223. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"],
  6224. referencedClasses: []
  6225. }),
  6226. globals.MethodInheritanceTest);
  6227. smalltalk.addMethod(
  6228. smalltalk.method({
  6229. selector: "setUp",
  6230. protocol: 'initialization',
  6231. fn: function (){
  6232. var self=this;
  6233. return smalltalk.withContext(function($ctx1) {
  6234. self["@receiverTop"]=_st(self._targetClassTop())._new();
  6235. $ctx1.sendIdx["new"]=1;
  6236. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  6237. $ctx1.sendIdx["new"]=2;
  6238. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  6239. self["@method"]=nil;
  6240. self["@performBlock"]=(function(){
  6241. return smalltalk.withContext(function($ctx2) {
  6242. return self._error_("performBlock not initialized");
  6243. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  6244. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},globals.MethodInheritanceTest)})},
  6245. args: [],
  6246. 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' ]",
  6247. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  6248. referencedClasses: []
  6249. }),
  6250. globals.MethodInheritanceTest);
  6251. smalltalk.addMethod(
  6252. smalltalk.method({
  6253. selector: "shouldMNU",
  6254. protocol: 'testing',
  6255. fn: function (){
  6256. var self=this;
  6257. return smalltalk.withContext(function($ctx1) {
  6258. self._shouldMNUTop();
  6259. self._shouldMNUMiddle();
  6260. self._shouldMNUBottom();
  6261. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},globals.MethodInheritanceTest)})},
  6262. args: [],
  6263. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  6264. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  6265. referencedClasses: []
  6266. }),
  6267. globals.MethodInheritanceTest);
  6268. smalltalk.addMethod(
  6269. smalltalk.method({
  6270. selector: "shouldMNUBottom",
  6271. protocol: 'testing',
  6272. fn: function (){
  6273. var self=this;
  6274. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6275. return smalltalk.withContext(function($ctx1) {
  6276. self._should_raise_((function(){
  6277. return smalltalk.withContext(function($ctx2) {
  6278. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6279. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6280. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},globals.MethodInheritanceTest)})},
  6281. args: [],
  6282. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  6283. messageSends: ["should:raise:", "value:"],
  6284. referencedClasses: ["MessageNotUnderstood"]
  6285. }),
  6286. globals.MethodInheritanceTest);
  6287. smalltalk.addMethod(
  6288. smalltalk.method({
  6289. selector: "shouldMNUMiddle",
  6290. protocol: 'testing',
  6291. fn: function (){
  6292. var self=this;
  6293. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6294. return smalltalk.withContext(function($ctx1) {
  6295. self._should_raise_((function(){
  6296. return smalltalk.withContext(function($ctx2) {
  6297. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6298. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6299. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},globals.MethodInheritanceTest)})},
  6300. args: [],
  6301. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  6302. messageSends: ["should:raise:", "value:"],
  6303. referencedClasses: ["MessageNotUnderstood"]
  6304. }),
  6305. globals.MethodInheritanceTest);
  6306. smalltalk.addMethod(
  6307. smalltalk.method({
  6308. selector: "shouldMNUTop",
  6309. protocol: 'testing',
  6310. fn: function (){
  6311. var self=this;
  6312. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6313. return smalltalk.withContext(function($ctx1) {
  6314. self._should_raise_((function(){
  6315. return smalltalk.withContext(function($ctx2) {
  6316. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  6317. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6318. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},globals.MethodInheritanceTest)})},
  6319. args: [],
  6320. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  6321. messageSends: ["should:raise:", "value:"],
  6322. referencedClasses: ["MessageNotUnderstood"]
  6323. }),
  6324. globals.MethodInheritanceTest);
  6325. smalltalk.addMethod(
  6326. smalltalk.method({
  6327. selector: "shouldReturn:",
  6328. protocol: 'testing',
  6329. fn: function (anObject){
  6330. var self=this;
  6331. var result;
  6332. return smalltalk.withContext(function($ctx1) {
  6333. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6334. $ctx1.sendIdx["value:"]=1;
  6335. self._assert_equals_(["top",anObject],["top",result]);
  6336. $ctx1.sendIdx["assert:equals:"]=1;
  6337. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6338. $ctx1.sendIdx["value:"]=2;
  6339. self._assert_equals_(["middle",anObject],["middle",result]);
  6340. $ctx1.sendIdx["assert:equals:"]=2;
  6341. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6342. self._assert_equals_(["bottom",anObject],["bottom",result]);
  6343. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},globals.MethodInheritanceTest)})},
  6344. args: ["anObject"],
  6345. 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 }",
  6346. messageSends: ["value:", "assert:equals:"],
  6347. referencedClasses: []
  6348. }),
  6349. globals.MethodInheritanceTest);
  6350. smalltalk.addMethod(
  6351. smalltalk.method({
  6352. selector: "shouldReturn:and:and:",
  6353. protocol: 'testing',
  6354. fn: function (anObject,anObject2,anObject3){
  6355. var self=this;
  6356. var result;
  6357. return smalltalk.withContext(function($ctx1) {
  6358. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  6359. $ctx1.sendIdx["value:"]=1;
  6360. self._assert_equals_(["top",anObject],["top",result]);
  6361. $ctx1.sendIdx["assert:equals:"]=1;
  6362. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  6363. $ctx1.sendIdx["value:"]=2;
  6364. self._assert_equals_(["middle",anObject2],["middle",result]);
  6365. $ctx1.sendIdx["assert:equals:"]=2;
  6366. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  6367. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  6368. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},globals.MethodInheritanceTest)})},
  6369. args: ["anObject", "anObject2", "anObject3"],
  6370. 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 }",
  6371. messageSends: ["value:", "assert:equals:"],
  6372. referencedClasses: []
  6373. }),
  6374. globals.MethodInheritanceTest);
  6375. smalltalk.addMethod(
  6376. smalltalk.method({
  6377. selector: "targetClassBottom",
  6378. protocol: 'accessing',
  6379. fn: function (){
  6380. var self=this;
  6381. function $JavaScriptException(){return globals.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  6382. return $JavaScriptException();
  6383. },
  6384. args: [],
  6385. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  6386. messageSends: [],
  6387. referencedClasses: ["JavaScriptException"]
  6388. }),
  6389. globals.MethodInheritanceTest);
  6390. smalltalk.addMethod(
  6391. smalltalk.method({
  6392. selector: "targetClassMiddle",
  6393. protocol: 'accessing',
  6394. fn: function (){
  6395. var self=this;
  6396. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  6397. return $Error();
  6398. },
  6399. args: [],
  6400. source: "targetClassMiddle\x0a\x09^ Error",
  6401. messageSends: [],
  6402. referencedClasses: ["Error"]
  6403. }),
  6404. globals.MethodInheritanceTest);
  6405. smalltalk.addMethod(
  6406. smalltalk.method({
  6407. selector: "targetClassTop",
  6408. protocol: 'accessing',
  6409. fn: function (){
  6410. var self=this;
  6411. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  6412. return $Object();
  6413. },
  6414. args: [],
  6415. source: "targetClassTop\x0a\x09^ Object",
  6416. messageSends: [],
  6417. referencedClasses: ["Object"]
  6418. }),
  6419. globals.MethodInheritanceTest);
  6420. smalltalk.addMethod(
  6421. smalltalk.method({
  6422. selector: "tearDown",
  6423. protocol: 'initialization',
  6424. fn: function (){
  6425. var self=this;
  6426. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  6427. return smalltalk.withContext(function($ctx1) {
  6428. _st((function(){
  6429. return smalltalk.withContext(function($ctx2) {
  6430. return self._deinstallTop();
  6431. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(){
  6432. }));
  6433. $ctx1.sendIdx["on:do:"]=1;
  6434. _st((function(){
  6435. return smalltalk.withContext(function($ctx2) {
  6436. return self._deinstallMiddle();
  6437. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._on_do_($Error(),(function(){
  6438. }));
  6439. $ctx1.sendIdx["on:do:"]=2;
  6440. _st((function(){
  6441. return smalltalk.withContext(function($ctx2) {
  6442. return self._deinstallBottom();
  6443. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}))._on_do_($Error(),(function(){
  6444. }));
  6445. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},globals.MethodInheritanceTest)})},
  6446. args: [],
  6447. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  6448. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  6449. referencedClasses: ["Error"]
  6450. }),
  6451. globals.MethodInheritanceTest);
  6452. smalltalk.addMethod(
  6453. smalltalk.method({
  6454. selector: "testMNU11",
  6455. protocol: 'tests',
  6456. fn: function (){
  6457. var self=this;
  6458. return smalltalk.withContext(function($ctx1) {
  6459. self["@performBlock"]=(function(x){
  6460. return smalltalk.withContext(function($ctx2) {
  6461. return _st(x)._foo();
  6462. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6463. self._shouldMNU();
  6464. $ctx1.sendIdx["shouldMNU"]=1;
  6465. self._installTop_("foo ^ false");
  6466. $ctx1.sendIdx["installTop:"]=1;
  6467. self._installTop_("foo ^ true");
  6468. self._deinstallTop();
  6469. self._shouldMNU();
  6470. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},globals.MethodInheritanceTest)})},
  6471. args: [],
  6472. 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",
  6473. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  6474. referencedClasses: []
  6475. }),
  6476. globals.MethodInheritanceTest);
  6477. smalltalk.addMethod(
  6478. smalltalk.method({
  6479. selector: "testMNU22",
  6480. protocol: 'tests',
  6481. fn: function (){
  6482. var self=this;
  6483. return smalltalk.withContext(function($ctx1) {
  6484. self["@performBlock"]=(function(x){
  6485. return smalltalk.withContext(function($ctx2) {
  6486. return _st(x)._foo();
  6487. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6488. self._shouldMNU();
  6489. $ctx1.sendIdx["shouldMNU"]=1;
  6490. self._installMiddle_("foo ^ false");
  6491. $ctx1.sendIdx["installMiddle:"]=1;
  6492. self._installMiddle_("foo ^ true");
  6493. self._deinstallMiddle();
  6494. self._shouldMNU();
  6495. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},globals.MethodInheritanceTest)})},
  6496. args: [],
  6497. 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",
  6498. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  6499. referencedClasses: []
  6500. }),
  6501. globals.MethodInheritanceTest);
  6502. smalltalk.addMethod(
  6503. smalltalk.method({
  6504. selector: "testReturns1",
  6505. protocol: 'tests',
  6506. fn: function (){
  6507. var self=this;
  6508. return smalltalk.withContext(function($ctx1) {
  6509. self["@performBlock"]=(function(x){
  6510. return smalltalk.withContext(function($ctx2) {
  6511. return _st(x)._foo();
  6512. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  6513. self._installTop_("foo ^ false");
  6514. $ctx1.sendIdx["installTop:"]=1;
  6515. self._shouldReturn_(false);
  6516. $ctx1.sendIdx["shouldReturn:"]=1;
  6517. self._installTop_("foo ^ true");
  6518. self._shouldReturn_(true);
  6519. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},globals.MethodInheritanceTest)})},
  6520. args: [],
  6521. 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",
  6522. messageSends: ["foo", "installTop:", "shouldReturn:"],
  6523. referencedClasses: []
  6524. }),
  6525. globals.MethodInheritanceTest);
  6526. smalltalk.addClass('NumberTest', globals.TestCase, [], 'Kernel-Tests');
  6527. smalltalk.addMethod(
  6528. smalltalk.method({
  6529. selector: "testAbs",
  6530. protocol: 'tests',
  6531. fn: function (){
  6532. var self=this;
  6533. return smalltalk.withContext(function($ctx1) {
  6534. var $1;
  6535. $1=(4)._abs();
  6536. $ctx1.sendIdx["abs"]=1;
  6537. self._assert_equals_($1,(4));
  6538. $ctx1.sendIdx["assert:equals:"]=1;
  6539. self._assert_equals_((-4)._abs(),(4));
  6540. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},globals.NumberTest)})},
  6541. args: [],
  6542. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  6543. messageSends: ["assert:equals:", "abs"],
  6544. referencedClasses: []
  6545. }),
  6546. globals.NumberTest);
  6547. smalltalk.addMethod(
  6548. smalltalk.method({
  6549. selector: "testArithmetic",
  6550. protocol: 'tests',
  6551. fn: function (){
  6552. var self=this;
  6553. return smalltalk.withContext(function($ctx1) {
  6554. var $1,$2,$3,$5,$4;
  6555. $1=(1.5).__plus((1));
  6556. $ctx1.sendIdx["+"]=1;
  6557. self._assert_equals_($1,(2.5));
  6558. $ctx1.sendIdx["assert:equals:"]=1;
  6559. $2=(2).__minus((1));
  6560. $ctx1.sendIdx["-"]=1;
  6561. self._assert_equals_($2,(1));
  6562. $ctx1.sendIdx["assert:equals:"]=2;
  6563. self._assert_equals_((-2).__minus((1)),(-3));
  6564. $ctx1.sendIdx["assert:equals:"]=3;
  6565. self._assert_equals_((12).__slash((2)),(6));
  6566. $ctx1.sendIdx["assert:equals:"]=4;
  6567. $3=(3).__star((4));
  6568. $ctx1.sendIdx["*"]=1;
  6569. self._assert_equals_($3,(12));
  6570. $ctx1.sendIdx["assert:equals:"]=5;
  6571. self._assert_equals_((7).__slash_slash((2)),(3));
  6572. $ctx1.sendIdx["assert:equals:"]=6;
  6573. self._assert_equals_((7).__backslash_backslash((2)),(1));
  6574. $ctx1.sendIdx["assert:equals:"]=7;
  6575. $5=(1).__plus((2));
  6576. $ctx1.sendIdx["+"]=2;
  6577. $4=_st($5).__star((3));
  6578. $ctx1.sendIdx["*"]=2;
  6579. self._assert_equals_($4,(9));
  6580. $ctx1.sendIdx["assert:equals:"]=8;
  6581. self._assert_equals_((1).__plus((2).__star((3))),(7));
  6582. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},globals.NumberTest)})},
  6583. args: [],
  6584. 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",
  6585. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"],
  6586. referencedClasses: []
  6587. }),
  6588. globals.NumberTest);
  6589. smalltalk.addMethod(
  6590. smalltalk.method({
  6591. selector: "testAsNumber",
  6592. protocol: 'tests',
  6593. fn: function (){
  6594. var self=this;
  6595. return smalltalk.withContext(function($ctx1) {
  6596. self._assert_equals_((3)._asNumber(),(3));
  6597. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},globals.NumberTest)})},
  6598. args: [],
  6599. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  6600. messageSends: ["assert:equals:", "asNumber"],
  6601. referencedClasses: []
  6602. }),
  6603. globals.NumberTest);
  6604. smalltalk.addMethod(
  6605. smalltalk.method({
  6606. selector: "testCeiling",
  6607. protocol: 'tests',
  6608. fn: function (){
  6609. var self=this;
  6610. return smalltalk.withContext(function($ctx1) {
  6611. var $1,$2;
  6612. $1=(1.2)._ceiling();
  6613. $ctx1.sendIdx["ceiling"]=1;
  6614. self._assert_equals_($1,(2));
  6615. $ctx1.sendIdx["assert:equals:"]=1;
  6616. $2=(-1.2)._ceiling();
  6617. $ctx1.sendIdx["ceiling"]=2;
  6618. self._assert_equals_($2,(-1));
  6619. $ctx1.sendIdx["assert:equals:"]=2;
  6620. self._assert_equals_((1)._ceiling(),(1));
  6621. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},globals.NumberTest)})},
  6622. args: [],
  6623. 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.",
  6624. messageSends: ["assert:equals:", "ceiling"],
  6625. referencedClasses: []
  6626. }),
  6627. globals.NumberTest);
  6628. smalltalk.addMethod(
  6629. smalltalk.method({
  6630. selector: "testComparison",
  6631. protocol: 'tests',
  6632. fn: function (){
  6633. var self=this;
  6634. return smalltalk.withContext(function($ctx1) {
  6635. var $1,$2,$3,$4;
  6636. $1=(3).__gt((2));
  6637. $ctx1.sendIdx[">"]=1;
  6638. self._assert_($1);
  6639. $ctx1.sendIdx["assert:"]=1;
  6640. $2=(2).__lt((3));
  6641. $ctx1.sendIdx["<"]=1;
  6642. self._assert_($2);
  6643. $ctx1.sendIdx["assert:"]=2;
  6644. self._deny_((3).__lt((2)));
  6645. $ctx1.sendIdx["deny:"]=1;
  6646. self._deny_((2).__gt((3)));
  6647. $3=(3).__gt_eq((3));
  6648. $ctx1.sendIdx[">="]=1;
  6649. self._assert_($3);
  6650. $ctx1.sendIdx["assert:"]=3;
  6651. self._assert_((3.1).__gt_eq((3)));
  6652. $ctx1.sendIdx["assert:"]=4;
  6653. $4=(3).__lt_eq((3));
  6654. $ctx1.sendIdx["<="]=1;
  6655. self._assert_($4);
  6656. $ctx1.sendIdx["assert:"]=5;
  6657. self._assert_((3).__lt_eq((3.1)));
  6658. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.NumberTest)})},
  6659. args: [],
  6660. 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",
  6661. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  6662. referencedClasses: []
  6663. }),
  6664. globals.NumberTest);
  6665. smalltalk.addMethod(
  6666. smalltalk.method({
  6667. selector: "testCopying",
  6668. protocol: 'tests',
  6669. fn: function (){
  6670. var self=this;
  6671. return smalltalk.withContext(function($ctx1) {
  6672. var $1;
  6673. $1=_st((1)._copy()).__eq_eq((1));
  6674. $ctx1.sendIdx["=="]=1;
  6675. self._assert_($1);
  6676. $ctx1.sendIdx["assert:"]=1;
  6677. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  6678. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},globals.NumberTest)})},
  6679. args: [],
  6680. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  6681. messageSends: ["assert:", "==", "copy", "deepCopy"],
  6682. referencedClasses: []
  6683. }),
  6684. globals.NumberTest);
  6685. smalltalk.addMethod(
  6686. smalltalk.method({
  6687. selector: "testEquality",
  6688. protocol: 'tests',
  6689. fn: function (){
  6690. var self=this;
  6691. return smalltalk.withContext(function($ctx1) {
  6692. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  6693. $1=(1).__eq((1));
  6694. $ctx1.sendIdx["="]=1;
  6695. self._assert_($1);
  6696. $ctx1.sendIdx["assert:"]=1;
  6697. $2=(0).__eq((0));
  6698. $ctx1.sendIdx["="]=2;
  6699. self._assert_($2);
  6700. $ctx1.sendIdx["assert:"]=2;
  6701. $3=(1).__eq((0));
  6702. $ctx1.sendIdx["="]=3;
  6703. self._deny_($3);
  6704. $ctx1.sendIdx["deny:"]=1;
  6705. $5=(1)._yourself();
  6706. $ctx1.sendIdx["yourself"]=1;
  6707. $4=_st($5).__eq((1));
  6708. $ctx1.sendIdx["="]=4;
  6709. self._assert_($4);
  6710. $ctx1.sendIdx["assert:"]=3;
  6711. $7=(1)._yourself();
  6712. $ctx1.sendIdx["yourself"]=2;
  6713. $6=(1).__eq($7);
  6714. $ctx1.sendIdx["="]=5;
  6715. self._assert_($6);
  6716. $ctx1.sendIdx["assert:"]=4;
  6717. $9=(1)._yourself();
  6718. $ctx1.sendIdx["yourself"]=3;
  6719. $8=_st($9).__eq((1)._yourself());
  6720. $ctx1.sendIdx["="]=6;
  6721. self._assert_($8);
  6722. $10=(0).__eq(false);
  6723. $ctx1.sendIdx["="]=7;
  6724. self._deny_($10);
  6725. $ctx1.sendIdx["deny:"]=2;
  6726. $11=false.__eq((0));
  6727. $ctx1.sendIdx["="]=8;
  6728. self._deny_($11);
  6729. $ctx1.sendIdx["deny:"]=3;
  6730. $12="".__eq((0));
  6731. $ctx1.sendIdx["="]=9;
  6732. self._deny_($12);
  6733. $ctx1.sendIdx["deny:"]=4;
  6734. self._deny_((0).__eq(""));
  6735. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},globals.NumberTest)})},
  6736. args: [],
  6737. 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 = ''",
  6738. messageSends: ["assert:", "=", "deny:", "yourself"],
  6739. referencedClasses: []
  6740. }),
  6741. globals.NumberTest);
  6742. smalltalk.addMethod(
  6743. smalltalk.method({
  6744. selector: "testFloor",
  6745. protocol: 'tests',
  6746. fn: function (){
  6747. var self=this;
  6748. return smalltalk.withContext(function($ctx1) {
  6749. var $1,$2;
  6750. $1=(1.2)._floor();
  6751. $ctx1.sendIdx["floor"]=1;
  6752. self._assert_equals_($1,(1));
  6753. $ctx1.sendIdx["assert:equals:"]=1;
  6754. $2=(-1.2)._floor();
  6755. $ctx1.sendIdx["floor"]=2;
  6756. self._assert_equals_($2,(-2));
  6757. $ctx1.sendIdx["assert:equals:"]=2;
  6758. self._assert_equals_((1)._floor(),(1));
  6759. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},globals.NumberTest)})},
  6760. args: [],
  6761. 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.",
  6762. messageSends: ["assert:equals:", "floor"],
  6763. referencedClasses: []
  6764. }),
  6765. globals.NumberTest);
  6766. smalltalk.addMethod(
  6767. smalltalk.method({
  6768. selector: "testHexNumbers",
  6769. protocol: 'tests',
  6770. fn: function (){
  6771. var self=this;
  6772. return smalltalk.withContext(function($ctx1) {
  6773. var $1,$2,$3,$4,$5;
  6774. self._assert_equals_((9),(9));
  6775. $ctx1.sendIdx["assert:equals:"]=1;
  6776. $1=(10)._truncated();
  6777. $ctx1.sendIdx["truncated"]=1;
  6778. self._assert_equals_($1,(10));
  6779. $ctx1.sendIdx["assert:equals:"]=2;
  6780. $2=(11)._truncated();
  6781. $ctx1.sendIdx["truncated"]=2;
  6782. self._assert_equals_($2,(11));
  6783. $ctx1.sendIdx["assert:equals:"]=3;
  6784. $3=(12)._truncated();
  6785. $ctx1.sendIdx["truncated"]=3;
  6786. self._assert_equals_($3,(12));
  6787. $ctx1.sendIdx["assert:equals:"]=4;
  6788. $4=(13)._truncated();
  6789. $ctx1.sendIdx["truncated"]=4;
  6790. self._assert_equals_($4,(13));
  6791. $ctx1.sendIdx["assert:equals:"]=5;
  6792. $5=(14)._truncated();
  6793. $ctx1.sendIdx["truncated"]=5;
  6794. self._assert_equals_($5,(14));
  6795. $ctx1.sendIdx["assert:equals:"]=6;
  6796. self._assert_equals_((15)._truncated(),(15));
  6797. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},globals.NumberTest)})},
  6798. args: [],
  6799. 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",
  6800. messageSends: ["assert:equals:", "truncated"],
  6801. referencedClasses: []
  6802. }),
  6803. globals.NumberTest);
  6804. smalltalk.addMethod(
  6805. smalltalk.method({
  6806. selector: "testIdentity",
  6807. protocol: 'tests',
  6808. fn: function (){
  6809. var self=this;
  6810. return smalltalk.withContext(function($ctx1) {
  6811. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  6812. $1=(1).__eq_eq((1));
  6813. $ctx1.sendIdx["=="]=1;
  6814. self._assert_($1);
  6815. $ctx1.sendIdx["assert:"]=1;
  6816. $2=(0).__eq_eq((0));
  6817. $ctx1.sendIdx["=="]=2;
  6818. self._assert_($2);
  6819. $ctx1.sendIdx["assert:"]=2;
  6820. $3=(1).__eq_eq((0));
  6821. $ctx1.sendIdx["=="]=3;
  6822. self._deny_($3);
  6823. $ctx1.sendIdx["deny:"]=1;
  6824. $5=(1)._yourself();
  6825. $ctx1.sendIdx["yourself"]=1;
  6826. $4=_st($5).__eq_eq((1));
  6827. $ctx1.sendIdx["=="]=4;
  6828. self._assert_($4);
  6829. $ctx1.sendIdx["assert:"]=3;
  6830. $7=(1)._yourself();
  6831. $ctx1.sendIdx["yourself"]=2;
  6832. $6=(1).__eq_eq($7);
  6833. $ctx1.sendIdx["=="]=5;
  6834. self._assert_($6);
  6835. $ctx1.sendIdx["assert:"]=4;
  6836. $9=(1)._yourself();
  6837. $ctx1.sendIdx["yourself"]=3;
  6838. $8=_st($9).__eq_eq((1)._yourself());
  6839. $ctx1.sendIdx["=="]=6;
  6840. self._assert_($8);
  6841. self._deny_((1).__eq_eq((2)));
  6842. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},globals.NumberTest)})},
  6843. args: [],
  6844. 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",
  6845. messageSends: ["assert:", "==", "deny:", "yourself"],
  6846. referencedClasses: []
  6847. }),
  6848. globals.NumberTest);
  6849. smalltalk.addMethod(
  6850. smalltalk.method({
  6851. selector: "testInvalidHexNumbers",
  6852. protocol: 'tests',
  6853. fn: function (){
  6854. var self=this;
  6855. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6856. return smalltalk.withContext(function($ctx1) {
  6857. self._should_raise_((function(){
  6858. return smalltalk.withContext(function($ctx2) {
  6859. return (16)._rG();
  6860. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6861. $ctx1.sendIdx["should:raise:"]=1;
  6862. self._should_raise_((function(){
  6863. return smalltalk.withContext(function($ctx2) {
  6864. return (16)._rg();
  6865. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$MessageNotUnderstood());
  6866. $ctx1.sendIdx["should:raise:"]=2;
  6867. self._should_raise_((function(){
  6868. return smalltalk.withContext(function($ctx2) {
  6869. return (16)._rH();
  6870. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$MessageNotUnderstood());
  6871. $ctx1.sendIdx["should:raise:"]=3;
  6872. self._should_raise_((function(){
  6873. return smalltalk.withContext(function($ctx2) {
  6874. return (16)._rh();
  6875. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),$MessageNotUnderstood());
  6876. $ctx1.sendIdx["should:raise:"]=4;
  6877. self._should_raise_((function(){
  6878. return smalltalk.withContext(function($ctx2) {
  6879. return (16)._rI();
  6880. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),$MessageNotUnderstood());
  6881. $ctx1.sendIdx["should:raise:"]=5;
  6882. self._should_raise_((function(){
  6883. return smalltalk.withContext(function($ctx2) {
  6884. return (16)._ri();
  6885. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}),$MessageNotUnderstood());
  6886. $ctx1.sendIdx["should:raise:"]=6;
  6887. self._should_raise_((function(){
  6888. return smalltalk.withContext(function($ctx2) {
  6889. return (16)._rJ();
  6890. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$MessageNotUnderstood());
  6891. $ctx1.sendIdx["should:raise:"]=7;
  6892. self._should_raise_((function(){
  6893. return smalltalk.withContext(function($ctx2) {
  6894. return (16)._rj();
  6895. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}),$MessageNotUnderstood());
  6896. $ctx1.sendIdx["should:raise:"]=8;
  6897. self._should_raise_((function(){
  6898. return smalltalk.withContext(function($ctx2) {
  6899. return (16)._rK();
  6900. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),$MessageNotUnderstood());
  6901. $ctx1.sendIdx["should:raise:"]=9;
  6902. self._should_raise_((function(){
  6903. return smalltalk.withContext(function($ctx2) {
  6904. return (16)._rk();
  6905. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}),$MessageNotUnderstood());
  6906. $ctx1.sendIdx["should:raise:"]=10;
  6907. self._should_raise_((function(){
  6908. return smalltalk.withContext(function($ctx2) {
  6909. return (16)._rL();
  6910. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),$MessageNotUnderstood());
  6911. $ctx1.sendIdx["should:raise:"]=11;
  6912. self._should_raise_((function(){
  6913. return smalltalk.withContext(function($ctx2) {
  6914. return (16)._rl();
  6915. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}),$MessageNotUnderstood());
  6916. $ctx1.sendIdx["should:raise:"]=12;
  6917. self._should_raise_((function(){
  6918. return smalltalk.withContext(function($ctx2) {
  6919. return (16)._rM();
  6920. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}),$MessageNotUnderstood());
  6921. $ctx1.sendIdx["should:raise:"]=13;
  6922. self._should_raise_((function(){
  6923. return smalltalk.withContext(function($ctx2) {
  6924. return (16)._rm();
  6925. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}),$MessageNotUnderstood());
  6926. $ctx1.sendIdx["should:raise:"]=14;
  6927. self._should_raise_((function(){
  6928. return smalltalk.withContext(function($ctx2) {
  6929. return (16)._rN();
  6930. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)})}),$MessageNotUnderstood());
  6931. $ctx1.sendIdx["should:raise:"]=15;
  6932. self._should_raise_((function(){
  6933. return smalltalk.withContext(function($ctx2) {
  6934. return (16)._rn();
  6935. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)})}),$MessageNotUnderstood());
  6936. $ctx1.sendIdx["should:raise:"]=16;
  6937. self._should_raise_((function(){
  6938. return smalltalk.withContext(function($ctx2) {
  6939. return (16)._rO();
  6940. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)})}),$MessageNotUnderstood());
  6941. $ctx1.sendIdx["should:raise:"]=17;
  6942. self._should_raise_((function(){
  6943. return smalltalk.withContext(function($ctx2) {
  6944. return (16)._ro();
  6945. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)})}),$MessageNotUnderstood());
  6946. $ctx1.sendIdx["should:raise:"]=18;
  6947. self._should_raise_((function(){
  6948. return smalltalk.withContext(function($ctx2) {
  6949. return (16)._rP();
  6950. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)})}),$MessageNotUnderstood());
  6951. $ctx1.sendIdx["should:raise:"]=19;
  6952. self._should_raise_((function(){
  6953. return smalltalk.withContext(function($ctx2) {
  6954. return (16)._rp();
  6955. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)})}),$MessageNotUnderstood());
  6956. $ctx1.sendIdx["should:raise:"]=20;
  6957. self._should_raise_((function(){
  6958. return smalltalk.withContext(function($ctx2) {
  6959. return (16)._rQ();
  6960. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)})}),$MessageNotUnderstood());
  6961. $ctx1.sendIdx["should:raise:"]=21;
  6962. self._should_raise_((function(){
  6963. return smalltalk.withContext(function($ctx2) {
  6964. return (16)._rq();
  6965. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)})}),$MessageNotUnderstood());
  6966. $ctx1.sendIdx["should:raise:"]=22;
  6967. self._should_raise_((function(){
  6968. return smalltalk.withContext(function($ctx2) {
  6969. return (16)._rR();
  6970. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)})}),$MessageNotUnderstood());
  6971. $ctx1.sendIdx["should:raise:"]=23;
  6972. self._should_raise_((function(){
  6973. return smalltalk.withContext(function($ctx2) {
  6974. return (16)._rr();
  6975. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)})}),$MessageNotUnderstood());
  6976. $ctx1.sendIdx["should:raise:"]=24;
  6977. self._should_raise_((function(){
  6978. return smalltalk.withContext(function($ctx2) {
  6979. return (16)._rS();
  6980. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)})}),$MessageNotUnderstood());
  6981. $ctx1.sendIdx["should:raise:"]=25;
  6982. self._should_raise_((function(){
  6983. return smalltalk.withContext(function($ctx2) {
  6984. return (16)._rs();
  6985. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)})}),$MessageNotUnderstood());
  6986. $ctx1.sendIdx["should:raise:"]=26;
  6987. self._should_raise_((function(){
  6988. return smalltalk.withContext(function($ctx2) {
  6989. return (16)._rT();
  6990. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)})}),$MessageNotUnderstood());
  6991. $ctx1.sendIdx["should:raise:"]=27;
  6992. self._should_raise_((function(){
  6993. return smalltalk.withContext(function($ctx2) {
  6994. return (16)._rt();
  6995. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)})}),$MessageNotUnderstood());
  6996. $ctx1.sendIdx["should:raise:"]=28;
  6997. self._should_raise_((function(){
  6998. return smalltalk.withContext(function($ctx2) {
  6999. return (16)._rU();
  7000. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)})}),$MessageNotUnderstood());
  7001. $ctx1.sendIdx["should:raise:"]=29;
  7002. self._should_raise_((function(){
  7003. return smalltalk.withContext(function($ctx2) {
  7004. return (16)._ru();
  7005. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)})}),$MessageNotUnderstood());
  7006. $ctx1.sendIdx["should:raise:"]=30;
  7007. self._should_raise_((function(){
  7008. return smalltalk.withContext(function($ctx2) {
  7009. return (16)._rV();
  7010. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)})}),$MessageNotUnderstood());
  7011. $ctx1.sendIdx["should:raise:"]=31;
  7012. self._should_raise_((function(){
  7013. return smalltalk.withContext(function($ctx2) {
  7014. return (16)._rv();
  7015. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)})}),$MessageNotUnderstood());
  7016. $ctx1.sendIdx["should:raise:"]=32;
  7017. self._should_raise_((function(){
  7018. return smalltalk.withContext(function($ctx2) {
  7019. return (16)._rW();
  7020. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)})}),$MessageNotUnderstood());
  7021. $ctx1.sendIdx["should:raise:"]=33;
  7022. self._should_raise_((function(){
  7023. return smalltalk.withContext(function($ctx2) {
  7024. return (16)._rw();
  7025. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)})}),$MessageNotUnderstood());
  7026. $ctx1.sendIdx["should:raise:"]=34;
  7027. self._should_raise_((function(){
  7028. return smalltalk.withContext(function($ctx2) {
  7029. return (16)._rX();
  7030. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)})}),$MessageNotUnderstood());
  7031. $ctx1.sendIdx["should:raise:"]=35;
  7032. self._should_raise_((function(){
  7033. return smalltalk.withContext(function($ctx2) {
  7034. return (16)._rx();
  7035. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)})}),$MessageNotUnderstood());
  7036. $ctx1.sendIdx["should:raise:"]=36;
  7037. self._should_raise_((function(){
  7038. return smalltalk.withContext(function($ctx2) {
  7039. return (16)._rY();
  7040. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)})}),$MessageNotUnderstood());
  7041. $ctx1.sendIdx["should:raise:"]=37;
  7042. self._should_raise_((function(){
  7043. return smalltalk.withContext(function($ctx2) {
  7044. return (16)._ry();
  7045. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)})}),$MessageNotUnderstood());
  7046. $ctx1.sendIdx["should:raise:"]=38;
  7047. self._should_raise_((function(){
  7048. return smalltalk.withContext(function($ctx2) {
  7049. return (16)._rZ();
  7050. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)})}),$MessageNotUnderstood());
  7051. $ctx1.sendIdx["should:raise:"]=39;
  7052. self._should_raise_((function(){
  7053. return smalltalk.withContext(function($ctx2) {
  7054. return (16)._rz();
  7055. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)})}),$MessageNotUnderstood());
  7056. $ctx1.sendIdx["should:raise:"]=40;
  7057. self._should_raise_((function(){
  7058. return smalltalk.withContext(function($ctx2) {
  7059. return (11259375)._Z();
  7060. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)})}),$MessageNotUnderstood());
  7061. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},globals.NumberTest)})},
  7062. args: [],
  7063. 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.",
  7064. 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"],
  7065. referencedClasses: ["MessageNotUnderstood"]
  7066. }),
  7067. globals.NumberTest);
  7068. smalltalk.addMethod(
  7069. smalltalk.method({
  7070. selector: "testLog",
  7071. protocol: 'tests',
  7072. fn: function (){
  7073. var self=this;
  7074. function $Number(){return globals.Number||(typeof Number=="undefined"?nil:Number)}
  7075. return smalltalk.withContext(function($ctx1) {
  7076. self._assert_equals_((10000)._log(),(4));
  7077. $ctx1.sendIdx["assert:equals:"]=1;
  7078. self._assert_equals_((512)._log_((2)),(9));
  7079. $ctx1.sendIdx["assert:equals:"]=2;
  7080. self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  7081. return self}, function($ctx1) {$ctx1.fill(self,"testLog",{},globals.NumberTest)})},
  7082. args: [],
  7083. 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.",
  7084. messageSends: ["assert:equals:", "log", "log:", "ln", "e"],
  7085. referencedClasses: ["Number"]
  7086. }),
  7087. globals.NumberTest);
  7088. smalltalk.addMethod(
  7089. smalltalk.method({
  7090. selector: "testMinMax",
  7091. protocol: 'tests',
  7092. fn: function (){
  7093. var self=this;
  7094. return smalltalk.withContext(function($ctx1) {
  7095. self._assert_equals_((2)._max_((5)),(5));
  7096. $ctx1.sendIdx["assert:equals:"]=1;
  7097. self._assert_equals_((2)._min_((5)),(2));
  7098. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},globals.NumberTest)})},
  7099. args: [],
  7100. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  7101. messageSends: ["assert:equals:", "max:", "min:"],
  7102. referencedClasses: []
  7103. }),
  7104. globals.NumberTest);
  7105. smalltalk.addMethod(
  7106. smalltalk.method({
  7107. selector: "testNegated",
  7108. protocol: 'tests',
  7109. fn: function (){
  7110. var self=this;
  7111. return smalltalk.withContext(function($ctx1) {
  7112. var $1;
  7113. $1=(3)._negated();
  7114. $ctx1.sendIdx["negated"]=1;
  7115. self._assert_equals_($1,(-3));
  7116. $ctx1.sendIdx["assert:equals:"]=1;
  7117. self._assert_equals_((-3)._negated(),(3));
  7118. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},globals.NumberTest)})},
  7119. args: [],
  7120. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  7121. messageSends: ["assert:equals:", "negated"],
  7122. referencedClasses: []
  7123. }),
  7124. globals.NumberTest);
  7125. smalltalk.addMethod(
  7126. smalltalk.method({
  7127. selector: "testPrintShowingDecimalPlaces",
  7128. protocol: 'tests',
  7129. fn: function (){
  7130. var self=this;
  7131. return smalltalk.withContext(function($ctx1) {
  7132. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  7133. $1=(23)._printShowingDecimalPlaces_((2));
  7134. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  7135. self._assert_equals_($1,"23.00");
  7136. $ctx1.sendIdx["assert:equals:"]=1;
  7137. $2=(23.5698)._printShowingDecimalPlaces_((2));
  7138. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  7139. self._assert_equals_($2,"23.57");
  7140. $ctx1.sendIdx["assert:equals:"]=2;
  7141. $4=(234.567)._negated();
  7142. $ctx1.sendIdx["negated"]=1;
  7143. $3=_st($4)._printShowingDecimalPlaces_((5));
  7144. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  7145. self._assert_equals_($3,"-234.56700");
  7146. $ctx1.sendIdx["assert:equals:"]=3;
  7147. $5=(23.4567)._printShowingDecimalPlaces_((0));
  7148. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  7149. self._assert_equals_($5,"23");
  7150. $ctx1.sendIdx["assert:equals:"]=4;
  7151. $6=(23.5567)._printShowingDecimalPlaces_((0));
  7152. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  7153. self._assert_equals_($6,"24");
  7154. $ctx1.sendIdx["assert:equals:"]=5;
  7155. $8=(23.4567)._negated();
  7156. $ctx1.sendIdx["negated"]=2;
  7157. $7=_st($8)._printShowingDecimalPlaces_((0));
  7158. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  7159. self._assert_equals_($7,"-23");
  7160. $ctx1.sendIdx["assert:equals:"]=6;
  7161. $10=(23.5567)._negated();
  7162. $ctx1.sendIdx["negated"]=3;
  7163. $9=_st($10)._printShowingDecimalPlaces_((0));
  7164. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  7165. self._assert_equals_($9,"-24");
  7166. $ctx1.sendIdx["assert:equals:"]=7;
  7167. $11=(100000000)._printShowingDecimalPlaces_((1));
  7168. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  7169. self._assert_equals_($11,"100000000.0");
  7170. $ctx1.sendIdx["assert:equals:"]=8;
  7171. $12=(0.98)._printShowingDecimalPlaces_((5));
  7172. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  7173. self._assert_equals_($12,"0.98000");
  7174. $ctx1.sendIdx["assert:equals:"]=9;
  7175. $13=_st((0.98)._negated())._printShowingDecimalPlaces_((2));
  7176. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  7177. self._assert_equals_($13,"-0.98");
  7178. $ctx1.sendIdx["assert:equals:"]=10;
  7179. $14=(2.567)._printShowingDecimalPlaces_((2));
  7180. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  7181. self._assert_equals_($14,"2.57");
  7182. $ctx1.sendIdx["assert:equals:"]=11;
  7183. $15=(-2.567)._printShowingDecimalPlaces_((2));
  7184. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  7185. self._assert_equals_($15,"-2.57");
  7186. $ctx1.sendIdx["assert:equals:"]=12;
  7187. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  7188. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},globals.NumberTest)})},
  7189. args: [],
  7190. 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'.",
  7191. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  7192. referencedClasses: []
  7193. }),
  7194. globals.NumberTest);
  7195. smalltalk.addMethod(
  7196. smalltalk.method({
  7197. selector: "testRaisedTo",
  7198. protocol: 'tests',
  7199. fn: function (){
  7200. var self=this;
  7201. return smalltalk.withContext(function($ctx1) {
  7202. var $1,$2,$3;
  7203. $1=(2)._raisedTo_((4));
  7204. $ctx1.sendIdx["raisedTo:"]=1;
  7205. self._assert_equals_($1,(16));
  7206. $ctx1.sendIdx["assert:equals:"]=1;
  7207. $2=(2)._raisedTo_((0));
  7208. $ctx1.sendIdx["raisedTo:"]=2;
  7209. self._assert_equals_($2,(1));
  7210. $ctx1.sendIdx["assert:equals:"]=2;
  7211. $3=(2)._raisedTo_((-3));
  7212. $ctx1.sendIdx["raisedTo:"]=3;
  7213. self._assert_equals_($3,(0.125));
  7214. $ctx1.sendIdx["assert:equals:"]=3;
  7215. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  7216. $ctx1.sendIdx["assert:equals:"]=4;
  7217. self._assert_equals_((2).__star_star((4)),(16));
  7218. return self}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},globals.NumberTest)})},
  7219. args: [],
  7220. 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.",
  7221. messageSends: ["assert:equals:", "raisedTo:", "**"],
  7222. referencedClasses: []
  7223. }),
  7224. globals.NumberTest);
  7225. smalltalk.addMethod(
  7226. smalltalk.method({
  7227. selector: "testRounded",
  7228. protocol: 'tests',
  7229. fn: function (){
  7230. var self=this;
  7231. return smalltalk.withContext(function($ctx1) {
  7232. var $1,$2;
  7233. $1=(3)._rounded();
  7234. $ctx1.sendIdx["rounded"]=1;
  7235. self._assert_equals_($1,(3));
  7236. $ctx1.sendIdx["assert:equals:"]=1;
  7237. $2=(3.212)._rounded();
  7238. $ctx1.sendIdx["rounded"]=2;
  7239. self._assert_equals_($2,(3));
  7240. $ctx1.sendIdx["assert:equals:"]=2;
  7241. self._assert_equals_((3.51)._rounded(),(4));
  7242. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},globals.NumberTest)})},
  7243. args: [],
  7244. 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",
  7245. messageSends: ["assert:equals:", "rounded"],
  7246. referencedClasses: []
  7247. }),
  7248. globals.NumberTest);
  7249. smalltalk.addMethod(
  7250. smalltalk.method({
  7251. selector: "testSign",
  7252. protocol: 'tests',
  7253. fn: function (){
  7254. var self=this;
  7255. return smalltalk.withContext(function($ctx1) {
  7256. var $1,$2;
  7257. $1=(5)._sign();
  7258. $ctx1.sendIdx["sign"]=1;
  7259. self._assert_equals_($1,(1));
  7260. $ctx1.sendIdx["assert:equals:"]=1;
  7261. $2=(0)._sign();
  7262. $ctx1.sendIdx["sign"]=2;
  7263. self._assert_equals_($2,(0));
  7264. $ctx1.sendIdx["assert:equals:"]=2;
  7265. self._assert_equals_((-1.4)._sign(),(-1));
  7266. return self}, function($ctx1) {$ctx1.fill(self,"testSign",{},globals.NumberTest)})},
  7267. args: [],
  7268. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  7269. messageSends: ["assert:equals:", "sign"],
  7270. referencedClasses: []
  7271. }),
  7272. globals.NumberTest);
  7273. smalltalk.addMethod(
  7274. smalltalk.method({
  7275. selector: "testSqrt",
  7276. protocol: 'tests',
  7277. fn: function (){
  7278. var self=this;
  7279. return smalltalk.withContext(function($ctx1) {
  7280. var $1;
  7281. $1=(4)._sqrt();
  7282. $ctx1.sendIdx["sqrt"]=1;
  7283. self._assert_equals_($1,(2));
  7284. $ctx1.sendIdx["assert:equals:"]=1;
  7285. self._assert_equals_((16)._sqrt(),(4));
  7286. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},globals.NumberTest)})},
  7287. args: [],
  7288. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  7289. messageSends: ["assert:equals:", "sqrt"],
  7290. referencedClasses: []
  7291. }),
  7292. globals.NumberTest);
  7293. smalltalk.addMethod(
  7294. smalltalk.method({
  7295. selector: "testSquared",
  7296. protocol: 'tests',
  7297. fn: function (){
  7298. var self=this;
  7299. return smalltalk.withContext(function($ctx1) {
  7300. self._assert_equals_((4)._squared(),(16));
  7301. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},globals.NumberTest)})},
  7302. args: [],
  7303. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  7304. messageSends: ["assert:equals:", "squared"],
  7305. referencedClasses: []
  7306. }),
  7307. globals.NumberTest);
  7308. smalltalk.addMethod(
  7309. smalltalk.method({
  7310. selector: "testTimesRepeat",
  7311. protocol: 'tests',
  7312. fn: function (){
  7313. var self=this;
  7314. var i;
  7315. return smalltalk.withContext(function($ctx1) {
  7316. i=(0);
  7317. (0)._timesRepeat_((function(){
  7318. return smalltalk.withContext(function($ctx2) {
  7319. i=_st(i).__plus((1));
  7320. $ctx2.sendIdx["+"]=1;
  7321. return i;
  7322. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7323. $ctx1.sendIdx["timesRepeat:"]=1;
  7324. self._assert_equals_(i,(0));
  7325. $ctx1.sendIdx["assert:equals:"]=1;
  7326. (5)._timesRepeat_((function(){
  7327. return smalltalk.withContext(function($ctx2) {
  7328. i=_st(i).__plus((1));
  7329. return i;
  7330. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  7331. self._assert_equals_(i,(5));
  7332. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},globals.NumberTest)})},
  7333. args: [],
  7334. 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",
  7335. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  7336. referencedClasses: []
  7337. }),
  7338. globals.NumberTest);
  7339. smalltalk.addMethod(
  7340. smalltalk.method({
  7341. selector: "testTo",
  7342. protocol: 'tests',
  7343. fn: function (){
  7344. var self=this;
  7345. return smalltalk.withContext(function($ctx1) {
  7346. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  7347. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},globals.NumberTest)})},
  7348. args: [],
  7349. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  7350. messageSends: ["assert:equals:", "to:"],
  7351. referencedClasses: []
  7352. }),
  7353. globals.NumberTest);
  7354. smalltalk.addMethod(
  7355. smalltalk.method({
  7356. selector: "testToBy",
  7357. protocol: 'tests',
  7358. fn: function (){
  7359. var self=this;
  7360. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  7361. return smalltalk.withContext(function($ctx1) {
  7362. var $1;
  7363. $1=(0)._to_by_((6),(2));
  7364. $ctx1.sendIdx["to:by:"]=1;
  7365. self._assert_equals_($1,[(0), (2), (4), (6)]);
  7366. self._should_raise_((function(){
  7367. return smalltalk.withContext(function($ctx2) {
  7368. return (1)._to_by_((4),(0));
  7369. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7370. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},globals.NumberTest)})},
  7371. args: [],
  7372. 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",
  7373. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  7374. referencedClasses: ["Error"]
  7375. }),
  7376. globals.NumberTest);
  7377. smalltalk.addMethod(
  7378. smalltalk.method({
  7379. selector: "testTrigonometry",
  7380. protocol: 'tests',
  7381. fn: function (){
  7382. var self=this;
  7383. return smalltalk.withContext(function($ctx1) {
  7384. self._assert_equals_((0)._cos(),(1));
  7385. $ctx1.sendIdx["assert:equals:"]=1;
  7386. self._assert_equals_((0)._sin(),(0));
  7387. $ctx1.sendIdx["assert:equals:"]=2;
  7388. self._assert_equals_((0)._tan(),(0));
  7389. $ctx1.sendIdx["assert:equals:"]=3;
  7390. self._assert_equals_((1)._arcCos(),(0));
  7391. $ctx1.sendIdx["assert:equals:"]=4;
  7392. self._assert_equals_((0)._arcSin(),(0));
  7393. $ctx1.sendIdx["assert:equals:"]=5;
  7394. self._assert_equals_((0)._arcTan(),(0));
  7395. return self}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},globals.NumberTest)})},
  7396. args: [],
  7397. 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.",
  7398. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"],
  7399. referencedClasses: []
  7400. }),
  7401. globals.NumberTest);
  7402. smalltalk.addMethod(
  7403. smalltalk.method({
  7404. selector: "testTruncated",
  7405. protocol: 'tests',
  7406. fn: function (){
  7407. var self=this;
  7408. return smalltalk.withContext(function($ctx1) {
  7409. var $1,$2;
  7410. $1=(3)._truncated();
  7411. $ctx1.sendIdx["truncated"]=1;
  7412. self._assert_equals_($1,(3));
  7413. $ctx1.sendIdx["assert:equals:"]=1;
  7414. $2=(3.212)._truncated();
  7415. $ctx1.sendIdx["truncated"]=2;
  7416. self._assert_equals_($2,(3));
  7417. $ctx1.sendIdx["assert:equals:"]=2;
  7418. self._assert_equals_((3.51)._truncated(),(3));
  7419. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},globals.NumberTest)})},
  7420. args: [],
  7421. 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",
  7422. messageSends: ["assert:equals:", "truncated"],
  7423. referencedClasses: []
  7424. }),
  7425. globals.NumberTest);
  7426. smalltalk.addClass('ObjectMock', globals.Object, ['foo', 'bar'], 'Kernel-Tests');
  7427. globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  7428. smalltalk.addMethod(
  7429. smalltalk.method({
  7430. selector: "foo",
  7431. protocol: 'not yet classified',
  7432. fn: function (){
  7433. var self=this;
  7434. var $1;
  7435. $1=self["@foo"];
  7436. return $1;
  7437. },
  7438. args: [],
  7439. source: "foo\x0a\x09^ foo",
  7440. messageSends: [],
  7441. referencedClasses: []
  7442. }),
  7443. globals.ObjectMock);
  7444. smalltalk.addMethod(
  7445. smalltalk.method({
  7446. selector: "foo:",
  7447. protocol: 'not yet classified',
  7448. fn: function (anObject){
  7449. var self=this;
  7450. self["@foo"]=anObject;
  7451. return self},
  7452. args: ["anObject"],
  7453. source: "foo: anObject\x0a\x09foo := anObject",
  7454. messageSends: [],
  7455. referencedClasses: []
  7456. }),
  7457. globals.ObjectMock);
  7458. smalltalk.addClass('ObjectTest', globals.TestCase, [], 'Kernel-Tests');
  7459. smalltalk.addMethod(
  7460. smalltalk.method({
  7461. selector: "notDefined",
  7462. protocol: 'tests',
  7463. fn: function (){
  7464. var self=this;
  7465. return smalltalk.withContext(function($ctx1) {
  7466. return void 0;;
  7467. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},globals.ObjectTest)})},
  7468. args: [],
  7469. source: "notDefined\x0a\x09<return void 0;>",
  7470. messageSends: [],
  7471. referencedClasses: []
  7472. }),
  7473. globals.ObjectTest);
  7474. smalltalk.addMethod(
  7475. smalltalk.method({
  7476. selector: "testBasicAccess",
  7477. protocol: 'tests',
  7478. fn: function (){
  7479. var self=this;
  7480. var o;
  7481. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7482. return smalltalk.withContext(function($ctx1) {
  7483. var $1;
  7484. o=_st($Object())._new();
  7485. _st(o)._basicAt_put_("a",(1));
  7486. $1=_st(o)._basicAt_("a");
  7487. $ctx1.sendIdx["basicAt:"]=1;
  7488. self._assert_equals_($1,(1));
  7489. $ctx1.sendIdx["assert:equals:"]=1;
  7490. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  7491. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},globals.ObjectTest)})},
  7492. args: [],
  7493. 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",
  7494. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  7495. referencedClasses: ["Object"]
  7496. }),
  7497. globals.ObjectTest);
  7498. smalltalk.addMethod(
  7499. smalltalk.method({
  7500. selector: "testBasicPerform",
  7501. protocol: 'tests',
  7502. fn: function (){
  7503. var self=this;
  7504. var o;
  7505. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7506. return smalltalk.withContext(function($ctx1) {
  7507. o=_st($Object())._new();
  7508. _st(o)._basicAt_put_("func",(function(){
  7509. return "hello";
  7510. }));
  7511. $ctx1.sendIdx["basicAt:put:"]=1;
  7512. _st(o)._basicAt_put_("func2",(function(a){
  7513. return smalltalk.withContext(function($ctx2) {
  7514. return _st(a).__plus((1));
  7515. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}));
  7516. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  7517. $ctx1.sendIdx["assert:equals:"]=1;
  7518. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  7519. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},globals.ObjectTest)})},
  7520. args: [],
  7521. 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",
  7522. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  7523. referencedClasses: ["Object"]
  7524. }),
  7525. globals.ObjectTest);
  7526. smalltalk.addMethod(
  7527. smalltalk.method({
  7528. selector: "testDNU",
  7529. protocol: 'tests',
  7530. fn: function (){
  7531. var self=this;
  7532. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7533. function $MessageNotUnderstood(){return globals.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  7534. return smalltalk.withContext(function($ctx1) {
  7535. self._should_raise_((function(){
  7536. return smalltalk.withContext(function($ctx2) {
  7537. return _st(_st($Object())._new())._foo();
  7538. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  7539. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},globals.ObjectTest)})},
  7540. args: [],
  7541. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  7542. messageSends: ["should:raise:", "foo", "new"],
  7543. referencedClasses: ["Object", "MessageNotUnderstood"]
  7544. }),
  7545. globals.ObjectTest);
  7546. smalltalk.addMethod(
  7547. smalltalk.method({
  7548. selector: "testEquality",
  7549. protocol: 'tests',
  7550. fn: function (){
  7551. var self=this;
  7552. var o;
  7553. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7554. return smalltalk.withContext(function($ctx1) {
  7555. var $1,$2,$4,$3;
  7556. o=_st($Object())._new();
  7557. $ctx1.sendIdx["new"]=1;
  7558. $1=_st(o).__eq(_st($Object())._new());
  7559. $ctx1.sendIdx["="]=1;
  7560. self._deny_($1);
  7561. $2=_st(o).__eq(o);
  7562. $ctx1.sendIdx["="]=2;
  7563. self._assert_($2);
  7564. $ctx1.sendIdx["assert:"]=1;
  7565. $4=_st(o)._yourself();
  7566. $ctx1.sendIdx["yourself"]=1;
  7567. $3=_st($4).__eq(o);
  7568. $ctx1.sendIdx["="]=3;
  7569. self._assert_($3);
  7570. $ctx1.sendIdx["assert:"]=2;
  7571. self._assert_(_st(o).__eq(_st(o)._yourself()));
  7572. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},globals.ObjectTest)})},
  7573. args: [],
  7574. 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)",
  7575. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  7576. referencedClasses: ["Object"]
  7577. }),
  7578. globals.ObjectTest);
  7579. smalltalk.addMethod(
  7580. smalltalk.method({
  7581. selector: "testHalt",
  7582. protocol: 'tests',
  7583. fn: function (){
  7584. var self=this;
  7585. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7586. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  7587. return smalltalk.withContext(function($ctx1) {
  7588. self._should_raise_((function(){
  7589. return smalltalk.withContext(function($ctx2) {
  7590. return _st(_st($Object())._new())._halt();
  7591. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7592. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},globals.ObjectTest)})},
  7593. args: [],
  7594. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  7595. messageSends: ["should:raise:", "halt", "new"],
  7596. referencedClasses: ["Object", "Error"]
  7597. }),
  7598. globals.ObjectTest);
  7599. smalltalk.addMethod(
  7600. smalltalk.method({
  7601. selector: "testIdentity",
  7602. protocol: 'tests',
  7603. fn: function (){
  7604. var self=this;
  7605. var o;
  7606. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7607. return smalltalk.withContext(function($ctx1) {
  7608. var $1,$2,$4,$3;
  7609. o=_st($Object())._new();
  7610. $ctx1.sendIdx["new"]=1;
  7611. $1=_st(o).__eq_eq(_st($Object())._new());
  7612. $ctx1.sendIdx["=="]=1;
  7613. self._deny_($1);
  7614. $2=_st(o).__eq_eq(o);
  7615. $ctx1.sendIdx["=="]=2;
  7616. self._assert_($2);
  7617. $ctx1.sendIdx["assert:"]=1;
  7618. $4=_st(o)._yourself();
  7619. $ctx1.sendIdx["yourself"]=1;
  7620. $3=_st($4).__eq_eq(o);
  7621. $ctx1.sendIdx["=="]=3;
  7622. self._assert_($3);
  7623. $ctx1.sendIdx["assert:"]=2;
  7624. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  7625. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},globals.ObjectTest)})},
  7626. args: [],
  7627. 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",
  7628. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  7629. referencedClasses: ["Object"]
  7630. }),
  7631. globals.ObjectTest);
  7632. smalltalk.addMethod(
  7633. smalltalk.method({
  7634. selector: "testIfNil",
  7635. protocol: 'tests',
  7636. fn: function (){
  7637. var self=this;
  7638. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7639. return smalltalk.withContext(function($ctx1) {
  7640. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  7641. $2=_st($Object())._new();
  7642. $ctx1.sendIdx["new"]=1;
  7643. $1=_st($2)._isNil();
  7644. self._deny_($1);
  7645. $ctx1.sendIdx["deny:"]=1;
  7646. $5=_st($Object())._new();
  7647. $ctx1.sendIdx["new"]=2;
  7648. if(($receiver = $5) == null || $receiver.isNil){
  7649. $4=true;
  7650. } else {
  7651. $4=$5;
  7652. };
  7653. $3=_st($4).__eq(true);
  7654. self._deny_($3);
  7655. $7=_st($Object())._new();
  7656. $ctx1.sendIdx["new"]=3;
  7657. if(($receiver = $7) == null || $receiver.isNil){
  7658. $6=$7;
  7659. } else {
  7660. $6=true;
  7661. };
  7662. self._assert_equals_($6,true);
  7663. $ctx1.sendIdx["assert:equals:"]=1;
  7664. $9=_st($Object())._new();
  7665. $ctx1.sendIdx["new"]=4;
  7666. if(($receiver = $9) == null || $receiver.isNil){
  7667. $8=false;
  7668. } else {
  7669. $8=true;
  7670. };
  7671. self._assert_equals_($8,true);
  7672. $ctx1.sendIdx["assert:equals:"]=2;
  7673. $11=_st($Object())._new();
  7674. if(($receiver = $11) == null || $receiver.isNil){
  7675. $10=false;
  7676. } else {
  7677. $10=true;
  7678. };
  7679. self._assert_equals_($10,true);
  7680. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},globals.ObjectTest)})},
  7681. args: [],
  7682. 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",
  7683. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  7684. referencedClasses: ["Object"]
  7685. }),
  7686. globals.ObjectTest);
  7687. smalltalk.addMethod(
  7688. smalltalk.method({
  7689. selector: "testInstVars",
  7690. protocol: 'tests',
  7691. fn: function (){
  7692. var self=this;
  7693. var o;
  7694. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7695. return smalltalk.withContext(function($ctx1) {
  7696. var $1,$2;
  7697. o=_st($ObjectMock())._new();
  7698. $1=_st(o)._instVarAt_("foo");
  7699. $ctx1.sendIdx["instVarAt:"]=1;
  7700. self._assert_equals_($1,nil);
  7701. $ctx1.sendIdx["assert:equals:"]=1;
  7702. _st(o)._instVarAt_put_("foo",(1));
  7703. $2=_st(o)._instVarAt_("foo");
  7704. $ctx1.sendIdx["instVarAt:"]=2;
  7705. self._assert_equals_($2,(1));
  7706. $ctx1.sendIdx["assert:equals:"]=2;
  7707. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  7708. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},globals.ObjectTest)})},
  7709. args: [],
  7710. 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",
  7711. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  7712. referencedClasses: ["ObjectMock"]
  7713. }),
  7714. globals.ObjectTest);
  7715. smalltalk.addMethod(
  7716. smalltalk.method({
  7717. selector: "testNilUndefined",
  7718. protocol: 'tests',
  7719. fn: function (){
  7720. var self=this;
  7721. return smalltalk.withContext(function($ctx1) {
  7722. self._assert_equals_(self._notDefined(),nil);
  7723. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},globals.ObjectTest)})},
  7724. args: [],
  7725. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  7726. messageSends: ["assert:equals:", "notDefined"],
  7727. referencedClasses: []
  7728. }),
  7729. globals.ObjectTest);
  7730. smalltalk.addMethod(
  7731. smalltalk.method({
  7732. selector: "testYourself",
  7733. protocol: 'tests',
  7734. fn: function (){
  7735. var self=this;
  7736. var o;
  7737. function $ObjectMock(){return globals.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  7738. return smalltalk.withContext(function($ctx1) {
  7739. o=_st($ObjectMock())._new();
  7740. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  7741. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},globals.ObjectTest)})},
  7742. args: [],
  7743. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  7744. messageSends: ["new", "assert:", "==", "yourself"],
  7745. referencedClasses: ["ObjectMock"]
  7746. }),
  7747. globals.ObjectTest);
  7748. smalltalk.addMethod(
  7749. smalltalk.method({
  7750. selector: "testidentityHash",
  7751. protocol: 'tests',
  7752. fn: function (){
  7753. var self=this;
  7754. var o1,o2;
  7755. function $Object(){return globals.Object||(typeof Object=="undefined"?nil:Object)}
  7756. return smalltalk.withContext(function($ctx1) {
  7757. var $2,$3,$1,$5,$4;
  7758. o1=_st($Object())._new();
  7759. $ctx1.sendIdx["new"]=1;
  7760. o2=_st($Object())._new();
  7761. $2=_st(o1)._identityHash();
  7762. $ctx1.sendIdx["identityHash"]=1;
  7763. $3=_st(o1)._identityHash();
  7764. $ctx1.sendIdx["identityHash"]=2;
  7765. $1=_st($2).__eq_eq($3);
  7766. $ctx1.sendIdx["=="]=1;
  7767. self._assert_($1);
  7768. $5=_st(o1)._identityHash();
  7769. $ctx1.sendIdx["identityHash"]=3;
  7770. $4=_st($5).__eq_eq(_st(o2)._identityHash());
  7771. self._deny_($4);
  7772. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},globals.ObjectTest)})},
  7773. args: [],
  7774. 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",
  7775. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  7776. referencedClasses: ["Object"]
  7777. }),
  7778. globals.ObjectTest);
  7779. smalltalk.addClass('PointTest', globals.TestCase, [], 'Kernel-Tests');
  7780. smalltalk.addMethod(
  7781. smalltalk.method({
  7782. selector: "testAccessing",
  7783. protocol: 'tests',
  7784. fn: function (){
  7785. var self=this;
  7786. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7787. return smalltalk.withContext(function($ctx1) {
  7788. var $2,$1,$3,$6,$5,$4;
  7789. $2=_st($Point())._x_y_((3),(4));
  7790. $ctx1.sendIdx["x:y:"]=1;
  7791. $1=_st($2)._x();
  7792. $ctx1.sendIdx["x"]=1;
  7793. self._assert_equals_($1,(3));
  7794. $ctx1.sendIdx["assert:equals:"]=1;
  7795. $3=_st(_st($Point())._x_y_((3),(4)))._y();
  7796. $ctx1.sendIdx["y"]=1;
  7797. self._assert_equals_($3,(4));
  7798. $ctx1.sendIdx["assert:equals:"]=2;
  7799. $6=_st($Point())._new();
  7800. $ctx1.sendIdx["new"]=1;
  7801. $5=_st($6)._x_((3));
  7802. $4=_st($5)._x();
  7803. self._assert_equals_($4,(3));
  7804. $ctx1.sendIdx["assert:equals:"]=3;
  7805. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  7806. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},globals.PointTest)})},
  7807. args: [],
  7808. 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",
  7809. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  7810. referencedClasses: ["Point"]
  7811. }),
  7812. globals.PointTest);
  7813. smalltalk.addMethod(
  7814. smalltalk.method({
  7815. selector: "testArithmetic",
  7816. protocol: 'tests',
  7817. fn: function (){
  7818. var self=this;
  7819. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7820. return smalltalk.withContext(function($ctx1) {
  7821. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  7822. $2=(3).__at((4));
  7823. $ctx1.sendIdx["@"]=1;
  7824. $3=(3).__at((4));
  7825. $ctx1.sendIdx["@"]=2;
  7826. $1=_st($2).__star($3);
  7827. $4=_st($Point())._x_y_((9),(16));
  7828. $ctx1.sendIdx["x:y:"]=1;
  7829. self._assert_equals_($1,$4);
  7830. $ctx1.sendIdx["assert:equals:"]=1;
  7831. $6=(3).__at((4));
  7832. $ctx1.sendIdx["@"]=3;
  7833. $7=(3).__at((4));
  7834. $ctx1.sendIdx["@"]=4;
  7835. $5=_st($6).__plus($7);
  7836. $8=_st($Point())._x_y_((6),(8));
  7837. $ctx1.sendIdx["x:y:"]=2;
  7838. self._assert_equals_($5,$8);
  7839. $ctx1.sendIdx["assert:equals:"]=2;
  7840. $10=(3).__at((4));
  7841. $ctx1.sendIdx["@"]=5;
  7842. $11=(3).__at((4));
  7843. $ctx1.sendIdx["@"]=6;
  7844. $9=_st($10).__minus($11);
  7845. $12=_st($Point())._x_y_((0),(0));
  7846. $ctx1.sendIdx["x:y:"]=3;
  7847. self._assert_equals_($9,$12);
  7848. $ctx1.sendIdx["assert:equals:"]=3;
  7849. $14=(6).__at((8));
  7850. $ctx1.sendIdx["@"]=7;
  7851. $13=_st($14).__slash((3).__at((4)));
  7852. self._assert_equals_($13,_st($Point())._x_y_((2),(2)));
  7853. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},globals.PointTest)})},
  7854. args: [],
  7855. 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)",
  7856. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  7857. referencedClasses: ["Point"]
  7858. }),
  7859. globals.PointTest);
  7860. smalltalk.addMethod(
  7861. smalltalk.method({
  7862. selector: "testAt",
  7863. protocol: 'tests',
  7864. fn: function (){
  7865. var self=this;
  7866. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7867. return smalltalk.withContext(function($ctx1) {
  7868. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  7869. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},globals.PointTest)})},
  7870. args: [],
  7871. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  7872. messageSends: ["assert:equals:", "@", "x:y:"],
  7873. referencedClasses: ["Point"]
  7874. }),
  7875. globals.PointTest);
  7876. smalltalk.addMethod(
  7877. smalltalk.method({
  7878. selector: "testComparison",
  7879. protocol: 'tests',
  7880. fn: function (){
  7881. var self=this;
  7882. return smalltalk.withContext(function($ctx1) {
  7883. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  7884. $2=(3).__at((4));
  7885. $ctx1.sendIdx["@"]=1;
  7886. $3=(4).__at((5));
  7887. $ctx1.sendIdx["@"]=2;
  7888. $1=_st($2).__lt($3);
  7889. $ctx1.sendIdx["<"]=1;
  7890. self._assert_($1);
  7891. $ctx1.sendIdx["assert:"]=1;
  7892. $5=(3).__at((4));
  7893. $ctx1.sendIdx["@"]=3;
  7894. $6=(4).__at((4));
  7895. $ctx1.sendIdx["@"]=4;
  7896. $4=_st($5).__lt($6);
  7897. self._deny_($4);
  7898. $ctx1.sendIdx["deny:"]=1;
  7899. $8=(4).__at((5));
  7900. $ctx1.sendIdx["@"]=5;
  7901. $9=(4).__at((5));
  7902. $ctx1.sendIdx["@"]=6;
  7903. $7=_st($8).__lt_eq($9);
  7904. $ctx1.sendIdx["<="]=1;
  7905. self._assert_($7);
  7906. $ctx1.sendIdx["assert:"]=2;
  7907. $11=(4).__at((5));
  7908. $ctx1.sendIdx["@"]=7;
  7909. $12=(3).__at((5));
  7910. $ctx1.sendIdx["@"]=8;
  7911. $10=_st($11).__lt_eq($12);
  7912. self._deny_($10);
  7913. $ctx1.sendIdx["deny:"]=2;
  7914. $14=(5).__at((6));
  7915. $ctx1.sendIdx["@"]=9;
  7916. $15=(4).__at((5));
  7917. $ctx1.sendIdx["@"]=10;
  7918. $13=_st($14).__gt($15);
  7919. $ctx1.sendIdx[">"]=1;
  7920. self._assert_($13);
  7921. $ctx1.sendIdx["assert:"]=3;
  7922. $17=(5).__at((6));
  7923. $ctx1.sendIdx["@"]=11;
  7924. $18=(6).__at((6));
  7925. $ctx1.sendIdx["@"]=12;
  7926. $16=_st($17).__gt($18);
  7927. self._deny_($16);
  7928. $ctx1.sendIdx["deny:"]=3;
  7929. $20=(4).__at((5));
  7930. $ctx1.sendIdx["@"]=13;
  7931. $21=(4).__at((5));
  7932. $ctx1.sendIdx["@"]=14;
  7933. $19=_st($20).__gt_eq($21);
  7934. $ctx1.sendIdx[">="]=1;
  7935. self._assert_($19);
  7936. $23=(4).__at((5));
  7937. $ctx1.sendIdx["@"]=15;
  7938. $22=_st($23).__gt_eq((5).__at((5)));
  7939. self._deny_($22);
  7940. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},globals.PointTest)})},
  7941. args: [],
  7942. source: "testComparison\x0a\x09self assert: 3@4 < (4@5).\x0a\x09self deny: 3@4 < (4@4).\x0a\x09\x0a\x09self assert: 4@5 <= (4@5).\x0a\x09self deny: 4@5 <= (3@5).\x0a\x09\x0a\x09self assert: 5@6 > (4@5).\x0a\x09self deny: 5@6 > (6@6).\x0a\x09\x0a\x09self assert: 4@5 >= (4@5).\x0a\x09self deny: 4@5 >= (5@5)",
  7943. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="],
  7944. referencedClasses: []
  7945. }),
  7946. globals.PointTest);
  7947. smalltalk.addMethod(
  7948. smalltalk.method({
  7949. selector: "testEgality",
  7950. protocol: 'tests',
  7951. fn: function (){
  7952. var self=this;
  7953. return smalltalk.withContext(function($ctx1) {
  7954. var $2,$3,$1,$5,$4;
  7955. $2=(3).__at((4));
  7956. $ctx1.sendIdx["@"]=1;
  7957. $3=(3).__at((4));
  7958. $ctx1.sendIdx["@"]=2;
  7959. $1=_st($2).__eq($3);
  7960. $ctx1.sendIdx["="]=1;
  7961. self._assert_($1);
  7962. $5=(3).__at((5));
  7963. $ctx1.sendIdx["@"]=3;
  7964. $4=_st($5).__eq((3).__at((6)));
  7965. self._deny_($4);
  7966. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},globals.PointTest)})},
  7967. args: [],
  7968. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  7969. messageSends: ["assert:", "=", "@", "deny:"],
  7970. referencedClasses: []
  7971. }),
  7972. globals.PointTest);
  7973. smalltalk.addMethod(
  7974. smalltalk.method({
  7975. selector: "testNew",
  7976. protocol: 'tests',
  7977. fn: function (){
  7978. var self=this;
  7979. function $Point(){return globals.Point||(typeof Point=="undefined"?nil:Point)}
  7980. return smalltalk.withContext(function($ctx1) {
  7981. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  7982. $3=_st($Point())._new();
  7983. $ctx1.sendIdx["new"]=1;
  7984. $2=_st($3)._x_((3));
  7985. $ctx1.sendIdx["x:"]=1;
  7986. $1=_st($2)._y();
  7987. $ctx1.sendIdx["y"]=1;
  7988. self._assert_equals_($1,nil);
  7989. $ctx1.sendIdx["assert:equals:"]=1;
  7990. $7=_st($Point())._new();
  7991. $ctx1.sendIdx["new"]=2;
  7992. $6=_st($7)._x_((3));
  7993. $5=_st($6)._x();
  7994. $ctx1.sendIdx["x"]=1;
  7995. $4=_st($5).__eq((0));
  7996. $ctx1.sendIdx["="]=1;
  7997. self._deny_($4);
  7998. $ctx1.sendIdx["deny:"]=1;
  7999. $10=_st($Point())._new();
  8000. $ctx1.sendIdx["new"]=3;
  8001. $9=_st($10)._y_((4));
  8002. $ctx1.sendIdx["y:"]=1;
  8003. $8=_st($9)._x();
  8004. self._assert_equals_($8,nil);
  8005. self._deny_(_st(_st(_st(_st($Point())._new())._y_((4)))._y()).__eq((0)));
  8006. return self}, function($ctx1) {$ctx1.fill(self,"testNew",{},globals.PointTest)})},
  8007. args: [],
  8008. 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",
  8009. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"],
  8010. referencedClasses: ["Point"]
  8011. }),
  8012. globals.PointTest);
  8013. smalltalk.addMethod(
  8014. smalltalk.method({
  8015. selector: "testTranslateBy",
  8016. protocol: 'tests',
  8017. fn: function (){
  8018. var self=this;
  8019. return smalltalk.withContext(function($ctx1) {
  8020. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  8021. $2=(3).__at((3));
  8022. $ctx1.sendIdx["@"]=1;
  8023. $3=(0).__at((1));
  8024. $ctx1.sendIdx["@"]=2;
  8025. $1=_st($2)._translateBy_($3);
  8026. $ctx1.sendIdx["translateBy:"]=1;
  8027. $4=(3).__at((4));
  8028. $ctx1.sendIdx["@"]=3;
  8029. self._assert_equals_($1,$4);
  8030. $ctx1.sendIdx["assert:equals:"]=1;
  8031. $6=(3).__at((3));
  8032. $ctx1.sendIdx["@"]=4;
  8033. $8=(1)._negated();
  8034. $ctx1.sendIdx["negated"]=1;
  8035. $7=(0).__at($8);
  8036. $ctx1.sendIdx["@"]=5;
  8037. $5=_st($6)._translateBy_($7);
  8038. $ctx1.sendIdx["translateBy:"]=2;
  8039. $9=(3).__at((2));
  8040. $ctx1.sendIdx["@"]=6;
  8041. self._assert_equals_($5,$9);
  8042. $ctx1.sendIdx["assert:equals:"]=2;
  8043. $11=(3).__at((3));
  8044. $ctx1.sendIdx["@"]=7;
  8045. $12=(2).__at((3));
  8046. $ctx1.sendIdx["@"]=8;
  8047. $10=_st($11)._translateBy_($12);
  8048. $ctx1.sendIdx["translateBy:"]=3;
  8049. $13=(5).__at((6));
  8050. $ctx1.sendIdx["@"]=9;
  8051. self._assert_equals_($10,$13);
  8052. $ctx1.sendIdx["assert:equals:"]=3;
  8053. $15=(3).__at((3));
  8054. $ctx1.sendIdx["@"]=10;
  8055. $16=_st((3)._negated()).__at((0));
  8056. $ctx1.sendIdx["@"]=11;
  8057. $14=_st($15)._translateBy_($16);
  8058. self._assert_equals_($14,(0).__at((3)));
  8059. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},globals.PointTest)})},
  8060. args: [],
  8061. 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.",
  8062. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  8063. referencedClasses: []
  8064. }),
  8065. globals.PointTest);
  8066. smalltalk.addClass('QueueTest', globals.TestCase, [], 'Kernel-Tests');
  8067. smalltalk.addMethod(
  8068. smalltalk.method({
  8069. selector: "testNextIfAbsent",
  8070. protocol: 'tests',
  8071. fn: function (){
  8072. var self=this;
  8073. var queue;
  8074. function $Queue(){return globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  8075. return smalltalk.withContext(function($ctx1) {
  8076. var $2,$1;
  8077. queue=_st($Queue())._new();
  8078. _st(queue)._nextPut_("index1");
  8079. $2=_st(queue)._nextIfAbsent_("empty");
  8080. $ctx1.sendIdx["nextIfAbsent:"]=1;
  8081. $1=_st($2).__eq("index1");
  8082. $ctx1.sendIdx["="]=1;
  8083. self._assert_($1);
  8084. self._deny_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
  8085. return self}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},globals.QueueTest)})},
  8086. args: [],
  8087. 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'",
  8088. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"],
  8089. referencedClasses: ["Queue"]
  8090. }),
  8091. globals.QueueTest);
  8092. smalltalk.addMethod(
  8093. smalltalk.method({
  8094. selector: "testQueueNext",
  8095. protocol: 'tests',
  8096. fn: function (){
  8097. var self=this;
  8098. var queue;
  8099. function $Queue(){return globals.Queue||(typeof Queue=="undefined"?nil:Queue)}
  8100. function $Error(){return globals.Error||(typeof Error=="undefined"?nil:Error)}
  8101. return smalltalk.withContext(function($ctx1) {
  8102. var $1,$2,$4,$3,$6,$5;
  8103. queue=_st($Queue())._new();
  8104. $1=queue;
  8105. _st($1)._nextPut_("index1");
  8106. $ctx1.sendIdx["nextPut:"]=1;
  8107. $2=_st($1)._nextPut_("index2");
  8108. $4=_st(queue)._next();
  8109. $ctx1.sendIdx["next"]=1;
  8110. $3=_st($4).__eq("index1");
  8111. $ctx1.sendIdx["="]=1;
  8112. self._assert_($3);
  8113. $6=_st(queue)._next();
  8114. $ctx1.sendIdx["next"]=2;
  8115. $5=_st($6).__eq("index");
  8116. self._deny_($5);
  8117. self._should_raise_((function(){
  8118. return smalltalk.withContext(function($ctx2) {
  8119. return _st(queue)._next();
  8120. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  8121. return self}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},globals.QueueTest)})},
  8122. args: [],
  8123. 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",
  8124. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"],
  8125. referencedClasses: ["Queue", "Error"]
  8126. }),
  8127. globals.QueueTest);
  8128. smalltalk.addClass('RandomTest', globals.TestCase, [], 'Kernel-Tests');
  8129. smalltalk.addMethod(
  8130. smalltalk.method({
  8131. selector: "testAtRandomNumber",
  8132. protocol: 'tests',
  8133. fn: function (){
  8134. var self=this;
  8135. var val;
  8136. return smalltalk.withContext(function($ctx1) {
  8137. (100)._timesRepeat_((function(){
  8138. return smalltalk.withContext(function($ctx2) {
  8139. val=(10)._atRandom();
  8140. val;
  8141. self._assert_(_st(val).__gt((0)));
  8142. $ctx2.sendIdx["assert:"]=1;
  8143. return self._assert_(_st(val).__lt((11)));
  8144. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  8145. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},globals.RandomTest)})},
  8146. args: [],
  8147. 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]",
  8148. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"],
  8149. referencedClasses: []
  8150. }),
  8151. globals.RandomTest);
  8152. smalltalk.addMethod(
  8153. smalltalk.method({
  8154. selector: "testAtRandomSequenceableCollection",
  8155. protocol: 'tests',
  8156. fn: function (){
  8157. var self=this;
  8158. var val;
  8159. return smalltalk.withContext(function($ctx1) {
  8160. var $3,$4,$2,$1;
  8161. (100)._timesRepeat_((function(){
  8162. return smalltalk.withContext(function($ctx2) {
  8163. val="abc"._atRandom();
  8164. val;
  8165. $3=_st(val).__eq("a");
  8166. $ctx2.sendIdx["="]=1;
  8167. $4=_st(val).__eq("b");
  8168. $ctx2.sendIdx["="]=2;
  8169. $2=_st($3).__or($4);
  8170. $1=_st($2).__or(_st(val).__eq("c"));
  8171. $ctx2.sendIdx["|"]=1;
  8172. return self._assert_($1);
  8173. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  8174. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},globals.RandomTest)})},
  8175. args: [],
  8176. 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].",
  8177. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="],
  8178. referencedClasses: []
  8179. }),
  8180. globals.RandomTest);
  8181. smalltalk.addMethod(
  8182. smalltalk.method({
  8183. selector: "textNext",
  8184. protocol: 'tests',
  8185. fn: function (){
  8186. var self=this;
  8187. function $Random(){return globals.Random||(typeof Random=="undefined"?nil:Random)}
  8188. return smalltalk.withContext(function($ctx1) {
  8189. var $1;
  8190. (10000)._timesRepeat_((function(){
  8191. var current,next;
  8192. return smalltalk.withContext(function($ctx2) {
  8193. next=_st(_st($Random())._new())._next();
  8194. next;
  8195. self._assert_(_st(next).__gt_eq((0)));
  8196. $ctx2.sendIdx["assert:"]=1;
  8197. self._assert_(_st(next).__lt((1)));
  8198. $1=_st(current).__eq(next);
  8199. $ctx2.sendIdx["="]=1;
  8200. self._deny_($1);
  8201. return _st(next).__eq(current);
  8202. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)})}));
  8203. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},globals.RandomTest)})},
  8204. args: [],
  8205. 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 ]",
  8206. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  8207. referencedClasses: ["Random"]
  8208. }),
  8209. globals.RandomTest);
  8210. smalltalk.addClass('StreamTest', globals.TestCase, [], 'Kernel-Tests');
  8211. smalltalk.addMethod(
  8212. smalltalk.method({
  8213. selector: "collectionClass",
  8214. protocol: 'accessing',
  8215. fn: function (){
  8216. var self=this;
  8217. return smalltalk.withContext(function($ctx1) {
  8218. var $1;
  8219. $1=_st(self._class())._collectionClass();
  8220. return $1;
  8221. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},globals.StreamTest)})},
  8222. args: [],
  8223. source: "collectionClass\x0a\x09^ self class collectionClass",
  8224. messageSends: ["collectionClass", "class"],
  8225. referencedClasses: []
  8226. }),
  8227. globals.StreamTest);
  8228. smalltalk.addMethod(
  8229. smalltalk.method({
  8230. selector: "newCollection",
  8231. protocol: 'accessing',
  8232. fn: function (){
  8233. var self=this;
  8234. return smalltalk.withContext(function($ctx1) {
  8235. var $1;
  8236. $1=_st(self._collectionClass())._new();
  8237. return $1;
  8238. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},globals.StreamTest)})},
  8239. args: [],
  8240. source: "newCollection\x0a\x09^ self collectionClass new",
  8241. messageSends: ["new", "collectionClass"],
  8242. referencedClasses: []
  8243. }),
  8244. globals.StreamTest);
  8245. smalltalk.addMethod(
  8246. smalltalk.method({
  8247. selector: "newStream",
  8248. protocol: 'accessing',
  8249. fn: function (){
  8250. var self=this;
  8251. return smalltalk.withContext(function($ctx1) {
  8252. var $1;
  8253. $1=_st(_st(self._collectionClass())._new())._stream();
  8254. return $1;
  8255. }, function($ctx1) {$ctx1.fill(self,"newStream",{},globals.StreamTest)})},
  8256. args: [],
  8257. source: "newStream\x0a\x09^ self collectionClass new stream",
  8258. messageSends: ["stream", "new", "collectionClass"],
  8259. referencedClasses: []
  8260. }),
  8261. globals.StreamTest);
  8262. smalltalk.addMethod(
  8263. smalltalk.method({
  8264. selector: "testAtStartAtEnd",
  8265. protocol: 'tests',
  8266. fn: function (){
  8267. var self=this;
  8268. var stream;
  8269. return smalltalk.withContext(function($ctx1) {
  8270. var $1,$2,$3,$4;
  8271. stream=self._newStream();
  8272. $1=_st(stream)._atStart();
  8273. $ctx1.sendIdx["atStart"]=1;
  8274. self._assert_($1);
  8275. $ctx1.sendIdx["assert:"]=1;
  8276. $2=_st(stream)._atEnd();
  8277. $ctx1.sendIdx["atEnd"]=1;
  8278. self._assert_($2);
  8279. $ctx1.sendIdx["assert:"]=2;
  8280. _st(stream)._nextPutAll_(self._newCollection());
  8281. $3=_st(stream)._atEnd();
  8282. $ctx1.sendIdx["atEnd"]=2;
  8283. self._assert_($3);
  8284. $4=_st(stream)._atStart();
  8285. $ctx1.sendIdx["atStart"]=2;
  8286. self._deny_($4);
  8287. $ctx1.sendIdx["deny:"]=1;
  8288. _st(stream)._position_((1));
  8289. self._deny_(_st(stream)._atEnd());
  8290. $ctx1.sendIdx["deny:"]=2;
  8291. self._deny_(_st(stream)._atStart());
  8292. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},globals.StreamTest)})},
  8293. args: [],
  8294. 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",
  8295. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  8296. referencedClasses: []
  8297. }),
  8298. globals.StreamTest);
  8299. smalltalk.addMethod(
  8300. smalltalk.method({
  8301. selector: "testContents",
  8302. protocol: 'tests',
  8303. fn: function (){
  8304. var self=this;
  8305. var stream;
  8306. return smalltalk.withContext(function($ctx1) {
  8307. var $1,$2;
  8308. stream=self._newStream();
  8309. $1=stream;
  8310. $2=self._newCollection();
  8311. $ctx1.sendIdx["newCollection"]=1;
  8312. _st($1)._nextPutAll_($2);
  8313. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  8314. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},globals.StreamTest)})},
  8315. args: [],
  8316. 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",
  8317. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  8318. referencedClasses: []
  8319. }),
  8320. globals.StreamTest);
  8321. smalltalk.addMethod(
  8322. smalltalk.method({
  8323. selector: "testIsEmpty",
  8324. protocol: 'tests',
  8325. fn: function (){
  8326. var self=this;
  8327. var stream;
  8328. return smalltalk.withContext(function($ctx1) {
  8329. var $1;
  8330. stream=self._newStream();
  8331. $1=_st(stream)._isEmpty();
  8332. $ctx1.sendIdx["isEmpty"]=1;
  8333. self._assert_($1);
  8334. _st(stream)._nextPutAll_(self._newCollection());
  8335. self._deny_(_st(stream)._isEmpty());
  8336. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},globals.StreamTest)})},
  8337. args: [],
  8338. 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",
  8339. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  8340. referencedClasses: []
  8341. }),
  8342. globals.StreamTest);
  8343. smalltalk.addMethod(
  8344. smalltalk.method({
  8345. selector: "testPosition",
  8346. protocol: 'tests',
  8347. fn: function (){
  8348. var self=this;
  8349. var collection,stream;
  8350. return smalltalk.withContext(function($ctx1) {
  8351. var $1,$2,$3;
  8352. collection=self._newCollection();
  8353. stream=self._newStream();
  8354. _st(stream)._nextPutAll_(collection);
  8355. $1=_st(stream)._position();
  8356. $ctx1.sendIdx["position"]=1;
  8357. self._assert_equals_($1,_st(collection)._size());
  8358. $ctx1.sendIdx["assert:equals:"]=1;
  8359. _st(stream)._position_((0));
  8360. $2=_st(stream)._position();
  8361. $ctx1.sendIdx["position"]=2;
  8362. self._assert_equals_($2,(0));
  8363. $ctx1.sendIdx["assert:equals:"]=2;
  8364. _st(stream)._next();
  8365. $ctx1.sendIdx["next"]=1;
  8366. $3=_st(stream)._position();
  8367. $ctx1.sendIdx["position"]=3;
  8368. self._assert_equals_($3,(1));
  8369. $ctx1.sendIdx["assert:equals:"]=3;
  8370. _st(stream)._next();
  8371. self._assert_equals_(_st(stream)._position(),(2));
  8372. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},globals.StreamTest)})},
  8373. args: [],
  8374. 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",
  8375. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  8376. referencedClasses: []
  8377. }),
  8378. globals.StreamTest);
  8379. smalltalk.addMethod(
  8380. smalltalk.method({
  8381. selector: "testReading",
  8382. protocol: 'tests',
  8383. fn: function (){
  8384. var self=this;
  8385. var stream,collection;
  8386. return smalltalk.withContext(function($ctx1) {
  8387. var $1,$2,$3;
  8388. collection=self._newCollection();
  8389. stream=self._newStream();
  8390. $1=stream;
  8391. _st($1)._nextPutAll_(collection);
  8392. $2=_st($1)._position_((0));
  8393. _st(collection)._do_((function(each){
  8394. return smalltalk.withContext(function($ctx2) {
  8395. $3=_st(stream)._next();
  8396. $ctx2.sendIdx["next"]=1;
  8397. return self._assert_equals_($3,each);
  8398. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8399. self._assert_(_st(_st(stream)._next())._isNil());
  8400. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},globals.StreamTest)})},
  8401. args: [],
  8402. 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",
  8403. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  8404. referencedClasses: []
  8405. }),
  8406. globals.StreamTest);
  8407. smalltalk.addMethod(
  8408. smalltalk.method({
  8409. selector: "testStreamContents",
  8410. protocol: 'tests',
  8411. fn: function (){
  8412. var self=this;
  8413. return self},
  8414. args: [],
  8415. source: "testStreamContents",
  8416. messageSends: [],
  8417. referencedClasses: []
  8418. }),
  8419. globals.StreamTest);
  8420. smalltalk.addMethod(
  8421. smalltalk.method({
  8422. selector: "testWrite",
  8423. protocol: 'tests',
  8424. fn: function (){
  8425. var self=this;
  8426. var stream,collection;
  8427. return smalltalk.withContext(function($ctx1) {
  8428. collection=self._newCollection();
  8429. stream=self._newStream();
  8430. _st(collection)._do_((function(each){
  8431. return smalltalk.withContext(function($ctx2) {
  8432. return _st(stream).__lt_lt(each);
  8433. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8434. self._assert_equals_(_st(stream)._contents(),collection);
  8435. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},globals.StreamTest)})},
  8436. args: [],
  8437. 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",
  8438. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  8439. referencedClasses: []
  8440. }),
  8441. globals.StreamTest);
  8442. smalltalk.addMethod(
  8443. smalltalk.method({
  8444. selector: "testWriting",
  8445. protocol: 'tests',
  8446. fn: function (){
  8447. var self=this;
  8448. var stream,collection;
  8449. return smalltalk.withContext(function($ctx1) {
  8450. var $1;
  8451. collection=self._newCollection();
  8452. stream=self._newStream();
  8453. $ctx1.sendIdx["newStream"]=1;
  8454. _st(collection)._do_((function(each){
  8455. return smalltalk.withContext(function($ctx2) {
  8456. return _st(stream)._nextPut_(each);
  8457. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  8458. $1=_st(stream)._contents();
  8459. $ctx1.sendIdx["contents"]=1;
  8460. self._assert_equals_($1,collection);
  8461. $ctx1.sendIdx["assert:equals:"]=1;
  8462. stream=self._newStream();
  8463. _st(stream)._nextPutAll_(collection);
  8464. self._assert_equals_(_st(stream)._contents(),collection);
  8465. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},globals.StreamTest)})},
  8466. args: [],
  8467. 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",
  8468. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  8469. referencedClasses: []
  8470. }),
  8471. globals.StreamTest);
  8472. smalltalk.addMethod(
  8473. smalltalk.method({
  8474. selector: "collectionClass",
  8475. protocol: 'accessing',
  8476. fn: function (){
  8477. var self=this;
  8478. return nil;
  8479. },
  8480. args: [],
  8481. source: "collectionClass\x0a\x09^ nil",
  8482. messageSends: [],
  8483. referencedClasses: []
  8484. }),
  8485. globals.StreamTest.klass);
  8486. smalltalk.addMethod(
  8487. smalltalk.method({
  8488. selector: "isAbstract",
  8489. protocol: 'testing',
  8490. fn: function (){
  8491. var self=this;
  8492. return smalltalk.withContext(function($ctx1) {
  8493. var $1;
  8494. $1=_st(self._collectionClass())._isNil();
  8495. return $1;
  8496. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},globals.StreamTest.klass)})},
  8497. args: [],
  8498. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  8499. messageSends: ["isNil", "collectionClass"],
  8500. referencedClasses: []
  8501. }),
  8502. globals.StreamTest.klass);
  8503. smalltalk.addClass('ArrayStreamTest', globals.StreamTest, [], 'Kernel-Tests');
  8504. smalltalk.addMethod(
  8505. smalltalk.method({
  8506. selector: "newCollection",
  8507. protocol: 'accessing',
  8508. fn: function (){
  8509. var self=this;
  8510. return smalltalk.withContext(function($ctx1) {
  8511. var $1;
  8512. $1=[true,(1),(3).__at((4)),"foo"];
  8513. return $1;
  8514. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},globals.ArrayStreamTest)})},
  8515. args: [],
  8516. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  8517. messageSends: ["@"],
  8518. referencedClasses: []
  8519. }),
  8520. globals.ArrayStreamTest);
  8521. smalltalk.addMethod(
  8522. smalltalk.method({
  8523. selector: "collectionClass",
  8524. protocol: 'accessing',
  8525. fn: function (){
  8526. var self=this;
  8527. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  8528. return $Array();
  8529. },
  8530. args: [],
  8531. source: "collectionClass\x0a\x09^ Array",
  8532. messageSends: [],
  8533. referencedClasses: ["Array"]
  8534. }),
  8535. globals.ArrayStreamTest.klass);
  8536. smalltalk.addClass('StringStreamTest', globals.StreamTest, [], 'Kernel-Tests');
  8537. smalltalk.addMethod(
  8538. smalltalk.method({
  8539. selector: "newCollection",
  8540. protocol: 'accessing',
  8541. fn: function (){
  8542. var self=this;
  8543. return "hello world";
  8544. },
  8545. args: [],
  8546. source: "newCollection\x0a\x09^ 'hello world'",
  8547. messageSends: [],
  8548. referencedClasses: []
  8549. }),
  8550. globals.StringStreamTest);
  8551. smalltalk.addMethod(
  8552. smalltalk.method({
  8553. selector: "collectionClass",
  8554. protocol: 'accessing',
  8555. fn: function (){
  8556. var self=this;
  8557. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  8558. return $String();
  8559. },
  8560. args: [],
  8561. source: "collectionClass\x0a\x09^ String",
  8562. messageSends: [],
  8563. referencedClasses: ["String"]
  8564. }),
  8565. globals.StringStreamTest.klass);
  8566. smalltalk.addClass('UndefinedTest', globals.TestCase, [], 'Kernel-Tests');
  8567. smalltalk.addMethod(
  8568. smalltalk.method({
  8569. selector: "testCopying",
  8570. protocol: 'tests',
  8571. fn: function (){
  8572. var self=this;
  8573. return smalltalk.withContext(function($ctx1) {
  8574. self._assert_equals_(nil._copy(),nil);
  8575. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},globals.UndefinedTest)})},
  8576. args: [],
  8577. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  8578. messageSends: ["assert:equals:", "copy"],
  8579. referencedClasses: []
  8580. }),
  8581. globals.UndefinedTest);
  8582. smalltalk.addMethod(
  8583. smalltalk.method({
  8584. selector: "testDeepCopy",
  8585. protocol: 'tests',
  8586. fn: function (){
  8587. var self=this;
  8588. return smalltalk.withContext(function($ctx1) {
  8589. self._assert_(_st(nil._deepCopy()).__eq(nil));
  8590. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},globals.UndefinedTest)})},
  8591. args: [],
  8592. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  8593. messageSends: ["assert:", "=", "deepCopy"],
  8594. referencedClasses: []
  8595. }),
  8596. globals.UndefinedTest);
  8597. smalltalk.addMethod(
  8598. smalltalk.method({
  8599. selector: "testIfNil",
  8600. protocol: 'tests',
  8601. fn: function (){
  8602. var self=this;
  8603. return smalltalk.withContext(function($ctx1) {
  8604. var $1,$3,$2,$4,$6,$5,$receiver;
  8605. if(($receiver = nil) == null || $receiver.isNil){
  8606. $1=true;
  8607. } else {
  8608. $1=nil;
  8609. };
  8610. self._assert_equals_($1,true);
  8611. $ctx1.sendIdx["assert:equals:"]=1;
  8612. if(($receiver = nil) == null || $receiver.isNil){
  8613. $3=nil;
  8614. } else {
  8615. $3=true;
  8616. };
  8617. $2=_st($3).__eq(true);
  8618. $ctx1.sendIdx["="]=1;
  8619. self._deny_($2);
  8620. $ctx1.sendIdx["deny:"]=1;
  8621. if(($receiver = nil) == null || $receiver.isNil){
  8622. $4=true;
  8623. } else {
  8624. $4=false;
  8625. };
  8626. self._assert_equals_($4,true);
  8627. if(($receiver = nil) == null || $receiver.isNil){
  8628. $6=false;
  8629. } else {
  8630. $6=true;
  8631. };
  8632. $5=_st($6).__eq(true);
  8633. self._deny_($5);
  8634. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},globals.UndefinedTest)})},
  8635. args: [],
  8636. 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",
  8637. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  8638. referencedClasses: []
  8639. }),
  8640. globals.UndefinedTest);
  8641. smalltalk.addMethod(
  8642. smalltalk.method({
  8643. selector: "testIsNil",
  8644. protocol: 'tests',
  8645. fn: function (){
  8646. var self=this;
  8647. return smalltalk.withContext(function($ctx1) {
  8648. self._assert_(nil._isNil());
  8649. self._deny_(nil._notNil());
  8650. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},globals.UndefinedTest)})},
  8651. args: [],
  8652. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  8653. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  8654. referencedClasses: []
  8655. }),
  8656. globals.UndefinedTest);
  8657. });