Kernel-Tests.js 307 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181
  1. define("amber_core/Kernel-Tests", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/SUnit", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Kernel-Tests');
  3. smalltalk.packages["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  4. smalltalk.addClass('AnnouncementSubscriptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5. smalltalk.addMethod(
  6. smalltalk.method({
  7. selector: "testHandlesAnnouncement",
  8. protocol: 'tests',
  9. fn: function (){
  10. var self=this;
  11. var subscription,announcementClass1,announcementClass2,classBuilder;
  12. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  13. function $SystemAnnouncement(){return smalltalk.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  14. function $AnnouncementSubscription(){return smalltalk.AnnouncementSubscription||(typeof AnnouncementSubscription=="undefined"?nil:AnnouncementSubscription)}
  15. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  16. return smalltalk.withContext(function($ctx1) {
  17. var $1,$2;
  18. classBuilder=_st($ClassBuilder())._new();
  19. $ctx1.sendIdx["new"]=1;
  20. announcementClass1=_st(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($SystemAnnouncement(),"TestAnnouncement1",[],"Kernel-Tests");
  21. subscription=_st(_st($AnnouncementSubscription())._new())._announcementClass_($SystemAnnouncement());
  22. $1=_st(subscription)._handlesAnnouncement_($SystemAnnouncement());
  23. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  24. self._assert_equals_($1,true);
  25. $ctx1.sendIdx["assert:equals:"]=1;
  26. $2=_st(subscription)._handlesAnnouncement_(announcementClass1);
  27. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  28. self._assert_equals_($2,true);
  29. $ctx1.sendIdx["assert:equals:"]=2;
  30. self._assert_equals_(_st(subscription)._handlesAnnouncement_($Object()),false);
  31. _st(classBuilder)._basicRemoveClass_(announcementClass1);
  32. return self}, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},smalltalk.AnnouncementSubscriptionTest)})},
  33. args: [],
  34. source: "testHandlesAnnouncement\x0a\x09| subscription announcementClass1 announcementClass2 classBuilder |\x0a\x09\x0a\x09classBuilder := ClassBuilder new.\x0a\x09announcementClass1 := classBuilder basicAddSubclassOf: SystemAnnouncement named: 'TestAnnouncement1' instanceVariableNames: #() package: 'Kernel-Tests'.\x0a\x09\x0a\x09subscription := AnnouncementSubscription new announcementClass: SystemAnnouncement.\x0a\x09\x22Test whether the same class triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: SystemAnnouncement) equals: true.\x0a\x09\x22Test whether a subclass triggers the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: announcementClass1) equals: true.\x0a\x09\x22Test whether an unrelated class does not trigger the announcement\x22\x0a\x09self assert: (subscription handlesAnnouncement: Object) equals: false.\x0a\x09\x0a\x09classBuilder basicRemoveClass: announcementClass1.",
  35. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"],
  36. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"]
  37. }),
  38. smalltalk.AnnouncementSubscriptionTest);
  39. smalltalk.addClass('AnnouncerTest', smalltalk.TestCase, [], 'Kernel-Tests');
  40. smalltalk.addMethod(
  41. smalltalk.method({
  42. selector: "testOnDo",
  43. protocol: 'not yet classified',
  44. fn: function (){
  45. var self=this;
  46. var counter,announcer;
  47. function $Announcer(){return smalltalk.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  48. function $SystemAnnouncement(){return smalltalk.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  49. return smalltalk.withContext(function($ctx1) {
  50. var $1,$2;
  51. counter=(0);
  52. announcer=_st($Announcer())._new();
  53. $ctx1.sendIdx["new"]=1;
  54. _st(announcer)._on_do_($SystemAnnouncement(),(function(){
  55. return smalltalk.withContext(function($ctx2) {
  56. counter=_st(counter).__plus((1));
  57. return counter;
  58. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  59. $1=announcer;
  60. $2=_st($SystemAnnouncement())._new();
  61. $ctx1.sendIdx["new"]=2;
  62. _st($1)._announce_($2);
  63. $ctx1.sendIdx["announce:"]=1;
  64. self._assert_equals_(counter,(1));
  65. $ctx1.sendIdx["assert:equals:"]=1;
  66. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  67. self._assert_equals_(counter,(2));
  68. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},smalltalk.AnnouncerTest)})},
  69. args: [],
  70. source: "testOnDo\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement do: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 2.",
  71. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"],
  72. referencedClasses: ["Announcer", "SystemAnnouncement"]
  73. }),
  74. smalltalk.AnnouncerTest);
  75. smalltalk.addMethod(
  76. smalltalk.method({
  77. selector: "testOnDoOnce",
  78. protocol: 'not yet classified',
  79. fn: function (){
  80. var self=this;
  81. var counter,announcer;
  82. function $Announcer(){return smalltalk.Announcer||(typeof Announcer=="undefined"?nil:Announcer)}
  83. function $SystemAnnouncement(){return smalltalk.SystemAnnouncement||(typeof SystemAnnouncement=="undefined"?nil:SystemAnnouncement)}
  84. return smalltalk.withContext(function($ctx1) {
  85. var $1,$2;
  86. counter=(0);
  87. announcer=_st($Announcer())._new();
  88. $ctx1.sendIdx["new"]=1;
  89. _st(announcer)._on_doOnce_($SystemAnnouncement(),(function(){
  90. return smalltalk.withContext(function($ctx2) {
  91. counter=_st(counter).__plus((1));
  92. return counter;
  93. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  94. $1=announcer;
  95. $2=_st($SystemAnnouncement())._new();
  96. $ctx1.sendIdx["new"]=2;
  97. _st($1)._announce_($2);
  98. $ctx1.sendIdx["announce:"]=1;
  99. self._assert_equals_(counter,(1));
  100. $ctx1.sendIdx["assert:equals:"]=1;
  101. _st(announcer)._announce_(_st($SystemAnnouncement())._new());
  102. self._assert_equals_(counter,(1));
  103. return self}, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},smalltalk.AnnouncerTest)})},
  104. args: [],
  105. source: "testOnDoOnce\x0a\x09| counter announcer |\x0a\x09\x0a\x09counter := 0.\x0a\x09announcer := Announcer new.\x0a\x09announcer on: SystemAnnouncement doOnce: [ counter := counter + 1 ].\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.\x0a\x0a\x09announcer announce: (SystemAnnouncement new).\x0a\x09self assert: counter equals: 1.",
  106. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"],
  107. referencedClasses: ["Announcer", "SystemAnnouncement"]
  108. }),
  109. smalltalk.AnnouncerTest);
  110. smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
  111. smalltalk.addMethod(
  112. smalltalk.method({
  113. selector: "testCanClearInterval",
  114. protocol: 'tests',
  115. fn: function (){
  116. var self=this;
  117. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  118. return smalltalk.withContext(function($ctx1) {
  119. self._shouldnt_raise_((function(){
  120. return smalltalk.withContext(function($ctx2) {
  121. return _st(_st((function(){
  122. return smalltalk.withContext(function($ctx3) {
  123. return _st(_st($Error())._new())._signal();
  124. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithInterval_((0)))._clearInterval();
  125. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  126. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},smalltalk.BlockClosureTest)})},
  127. args: [],
  128. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  129. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"],
  130. referencedClasses: ["Error"]
  131. }),
  132. smalltalk.BlockClosureTest);
  133. smalltalk.addMethod(
  134. smalltalk.method({
  135. selector: "testCanClearTimeout",
  136. protocol: 'tests',
  137. fn: function (){
  138. var self=this;
  139. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  140. return smalltalk.withContext(function($ctx1) {
  141. self._shouldnt_raise_((function(){
  142. return smalltalk.withContext(function($ctx2) {
  143. return _st(_st((function(){
  144. return smalltalk.withContext(function($ctx3) {
  145. return _st(_st($Error())._new())._signal();
  146. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._valueWithTimeout_((0)))._clearTimeout();
  147. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  148. return self}, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},smalltalk.BlockClosureTest)})},
  149. args: [],
  150. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  151. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"],
  152. referencedClasses: ["Error"]
  153. }),
  154. smalltalk.BlockClosureTest);
  155. smalltalk.addMethod(
  156. smalltalk.method({
  157. selector: "testCompiledSource",
  158. protocol: 'tests',
  159. fn: function (){
  160. var self=this;
  161. return smalltalk.withContext(function($ctx1) {
  162. self._assert_(_st(_st((function(){
  163. return smalltalk.withContext(function($ctx2) {
  164. return (1).__plus((1));
  165. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._compiledSource())._includesSubString_("function"));
  166. return self}, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},smalltalk.BlockClosureTest)})},
  167. args: [],
  168. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  169. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"],
  170. referencedClasses: []
  171. }),
  172. smalltalk.BlockClosureTest);
  173. smalltalk.addMethod(
  174. smalltalk.method({
  175. selector: "testCurrySelf",
  176. protocol: 'tests',
  177. fn: function (){
  178. var self=this;
  179. var curriedMethod,array;
  180. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  181. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  182. return smalltalk.withContext(function($ctx1) {
  183. curriedMethod=_st(_st((function(selfarg,x){
  184. return smalltalk.withContext(function($ctx2) {
  185. return _st(selfarg)._at_(x);
  186. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)})}))._currySelf())._asCompiledMethod_("foo:");
  187. array=[(3), (1), (4)];
  188. _st(_st($ClassBuilder())._new())._installMethod_forClass_protocol_(curriedMethod,$Array(),"**test helper");
  189. _st((function(){
  190. return smalltalk.withContext(function($ctx2) {
  191. return self._assert_equals_(_st(array)._foo_((2)),(1));
  192. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))._ensure_((function(){
  193. return smalltalk.withContext(function($ctx2) {
  194. return _st($Array())._removeCompiledMethod_(curriedMethod);
  195. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  196. return self}, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},smalltalk.BlockClosureTest)})},
  197. args: [],
  198. source: "testCurrySelf\x0a\x09| curriedMethod array |\x0a\x09curriedMethod := [ :selfarg :x | selfarg at: x ] currySelf asCompiledMethod: 'foo:'.\x0a\x09array := #(3 1 4).\x0a\x09ClassBuilder new installMethod: curriedMethod forClass: Array protocol: '**test helper'.\x0a\x09[ self assert: (array foo: 2) equals: 1 ]\x0a\x09ensure: [ Array removeCompiledMethod: curriedMethod ]",
  199. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"],
  200. referencedClasses: ["ClassBuilder", "Array"]
  201. }),
  202. smalltalk.BlockClosureTest);
  203. smalltalk.addMethod(
  204. smalltalk.method({
  205. selector: "testEnsure",
  206. protocol: 'tests',
  207. fn: function (){
  208. var self=this;
  209. return smalltalk.withContext(function($ctx1) {
  210. self._assert_equals_(_st((function(){
  211. return smalltalk.withContext(function($ctx2) {
  212. return (3);
  213. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._ensure_((function(){
  214. return smalltalk.withContext(function($ctx2) {
  215. return (4);
  216. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),(3));
  217. return self}, function($ctx1) {$ctx1.fill(self,"testEnsure",{},smalltalk.BlockClosureTest)})},
  218. args: [],
  219. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  220. messageSends: ["assert:equals:", "ensure:"],
  221. referencedClasses: []
  222. }),
  223. smalltalk.BlockClosureTest);
  224. smalltalk.addMethod(
  225. smalltalk.method({
  226. selector: "testEnsureRaises",
  227. protocol: 'tests',
  228. fn: function (){
  229. var self=this;
  230. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  231. return smalltalk.withContext(function($ctx1) {
  232. self._should_raise_((function(){
  233. return smalltalk.withContext(function($ctx2) {
  234. return _st((function(){
  235. return smalltalk.withContext(function($ctx3) {
  236. return _st(_st($Error())._new())._signal();
  237. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._ensure_((function(){
  238. return smalltalk.withContext(function($ctx3) {
  239. return true;
  240. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  241. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  242. return self}, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},smalltalk.BlockClosureTest)})},
  243. args: [],
  244. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  245. messageSends: ["should:raise:", "ensure:", "signal", "new"],
  246. referencedClasses: ["Error"]
  247. }),
  248. smalltalk.BlockClosureTest);
  249. smalltalk.addMethod(
  250. smalltalk.method({
  251. selector: "testExceptionSemantics",
  252. protocol: 'tests',
  253. fn: function (){
  254. var self=this;
  255. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  256. return smalltalk.withContext(function($ctx1) {
  257. self._timeout_((100));
  258. _st(self._async_((function(){
  259. return smalltalk.withContext(function($ctx2) {
  260. return _st((function(){
  261. return smalltalk.withContext(function($ctx3) {
  262. self._assert_(true);
  263. _st($Error())._signal();
  264. self._deny_(true);
  265. return self._finished();
  266. $ctx3.sendIdx["finished"]=1;
  267. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}))._on_do_($Error(),(function(ex){
  268. return smalltalk.withContext(function($ctx3) {
  269. return self._finished();
  270. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)})}));
  271. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})))._valueWithTimeout_((0));
  272. return self}, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},smalltalk.BlockClosureTest)})},
  273. args: [],
  274. source: "testExceptionSemantics\x0a\x09\x22See https://github.com/NicolasPetton/amber/issues/314\x22\x0a\x09self timeout: 100.\x0a\x09\x0a\x09(self async: [\x0a\x09\x09[\x0a\x09\x09\x09self assert: true.\x0a\x09\x09\x09Error signal.\x0a\x09\x09\x09\x22The following should *not* be run\x22\x0a\x09\x09\x09self deny: true.\x0a\x09\x09\x09self finished.\x0a\x09\x09] on: Error do: [ :ex | self finished ]\x0a\x09]) valueWithTimeout: 0",
  275. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"],
  276. referencedClasses: ["Error"]
  277. }),
  278. smalltalk.BlockClosureTest);
  279. smalltalk.addMethod(
  280. smalltalk.method({
  281. selector: "testNewWithValues",
  282. protocol: 'tests',
  283. fn: function (){
  284. var self=this;
  285. return smalltalk.withContext(function($ctx1) {
  286. function theTestPrototype() {this.name = "theTestPrototype";}
  287. function theTestConstructor(arg1, arg2, arg3) {}
  288. theTestConstructor.prototype = new theTestPrototype;
  289. var theWrappedConstructor = _st(theTestConstructor);
  290. var theResult = theWrappedConstructor._newWithValues_([1, 2, 3 ]);
  291. self._assert_equals_(Object.getPrototypeOf(theResult).name, 'theTestPrototype');
  292. "newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made."
  293. function constructionShouldFail() {var anotherResult = theWrappedConstructor._newWithValues_('This is so wrong');}
  294. self._should_raise_(_st(constructionShouldFail), smalltalk.Error);;
  295. return self}, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},smalltalk.BlockClosureTest)})},
  296. args: [],
  297. source: "testNewWithValues\x0a<\x0a\x09function theTestPrototype() {this.name = \x22theTestPrototype\x22;}\x0a\x09function theTestConstructor(arg1, arg2, arg3) {}\x0a\x09theTestConstructor.prototype = new theTestPrototype;\x0a\x0a\x09var theWrappedConstructor = _st(theTestConstructor);\x0a\x09var theResult = theWrappedConstructor._newWithValues_([1, 2, 3 ]);\x0a\x09self._assert_equals_(Object.getPrototypeOf(theResult).name, 'theTestPrototype');\x0a\x0a\x09\x22newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made.\x22\x0a\x09function constructionShouldFail() {var anotherResult = theWrappedConstructor._newWithValues_('This is so wrong');}\x0a\x09self._should_raise_(_st(constructionShouldFail), smalltalk.Error);\x0a>",
  298. messageSends: [],
  299. referencedClasses: []
  300. }),
  301. smalltalk.BlockClosureTest);
  302. smalltalk.addMethod(
  303. smalltalk.method({
  304. selector: "testNumArgs",
  305. protocol: 'tests',
  306. fn: function (){
  307. var self=this;
  308. return smalltalk.withContext(function($ctx1) {
  309. var $1;
  310. $1=_st((function(){
  311. return smalltalk.withContext(function($ctx2) {
  312. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._numArgs();
  313. $ctx1.sendIdx["numArgs"]=1;
  314. self._assert_equals_($1,(0));
  315. $ctx1.sendIdx["assert:equals:"]=1;
  316. self._assert_equals_(_st((function(a,b){
  317. return smalltalk.withContext(function($ctx2) {
  318. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)})}))._numArgs(),(2));
  319. return self}, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},smalltalk.BlockClosureTest)})},
  320. args: [],
  321. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  322. messageSends: ["assert:equals:", "numArgs"],
  323. referencedClasses: []
  324. }),
  325. smalltalk.BlockClosureTest);
  326. smalltalk.addMethod(
  327. smalltalk.method({
  328. selector: "testOnDo",
  329. protocol: 'tests',
  330. fn: function (){
  331. var self=this;
  332. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  333. return smalltalk.withContext(function($ctx1) {
  334. self._assert_(_st((function(){
  335. return smalltalk.withContext(function($ctx2) {
  336. return _st(_st($Error())._new())._signal();
  337. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(ex){
  338. return smalltalk.withContext(function($ctx2) {
  339. return true;
  340. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)})})));
  341. return self}, function($ctx1) {$ctx1.fill(self,"testOnDo",{},smalltalk.BlockClosureTest)})},
  342. args: [],
  343. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  344. messageSends: ["assert:", "on:do:", "signal", "new"],
  345. referencedClasses: ["Error"]
  346. }),
  347. smalltalk.BlockClosureTest);
  348. smalltalk.addMethod(
  349. smalltalk.method({
  350. selector: "testValue",
  351. protocol: 'tests',
  352. fn: function (){
  353. var self=this;
  354. return smalltalk.withContext(function($ctx1) {
  355. var $1;
  356. $1=_st((function(){
  357. return smalltalk.withContext(function($ctx2) {
  358. return (1).__plus((1));
  359. $ctx2.sendIdx["+"]=1;
  360. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._value();
  361. $ctx1.sendIdx["value"]=1;
  362. self._assert_equals_($1,(2));
  363. $ctx1.sendIdx["assert:equals:"]=1;
  364. self._assert_equals_(_st((function(x){
  365. return smalltalk.withContext(function($ctx2) {
  366. return _st(x).__plus((1));
  367. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}))._value_((2)),(3));
  368. $ctx1.sendIdx["assert:equals:"]=2;
  369. self._assert_equals_(_st((function(x,y){
  370. return smalltalk.withContext(function($ctx2) {
  371. return _st(x).__star(y);
  372. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)})}))._value_value_((2),(4)),(8));
  373. $ctx1.sendIdx["assert:equals:"]=3;
  374. self._assert_equals_(_st((function(a,b,c){
  375. return smalltalk.withContext(function($ctx2) {
  376. return (1);
  377. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b,c:c},$ctx1,4)})}))._value(),(1));
  378. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{},smalltalk.BlockClosureTest)})},
  379. args: [],
  380. source: "testValue\x0a\x09self assert: ([ 1+1 ] value) equals: 2.\x0a\x09self assert: ([ :x | x +1 ] value: 2) equals: 3.\x0a\x09self assert: ([ :x :y | x*y ] value: 2 value: 4) equals: 8.\x0a\x0a\x09\x22Arguments are optional in Amber. This isn't ANSI compliant.\x22\x0a\x0a\x09self assert: ([ :a :b :c | 1 ] value) equals: 1",
  381. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"],
  382. referencedClasses: []
  383. }),
  384. smalltalk.BlockClosureTest);
  385. smalltalk.addMethod(
  386. smalltalk.method({
  387. selector: "testValueWithPossibleArguments",
  388. protocol: 'tests',
  389. fn: function (){
  390. var self=this;
  391. return smalltalk.withContext(function($ctx1) {
  392. var $1,$2;
  393. $1=_st((function(){
  394. return smalltalk.withContext(function($ctx2) {
  395. return (1);
  396. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._valueWithPossibleArguments_([(3), (4)]);
  397. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  398. self._assert_equals_($1,(1));
  399. $ctx1.sendIdx["assert:equals:"]=1;
  400. $2=_st((function(a){
  401. return smalltalk.withContext(function($ctx2) {
  402. return _st(a).__plus((4));
  403. $ctx2.sendIdx["+"]=1;
  404. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}))._valueWithPossibleArguments_([(3), (4)]);
  405. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  406. self._assert_equals_($2,(7));
  407. $ctx1.sendIdx["assert:equals:"]=2;
  408. self._assert_equals_(_st((function(a,b){
  409. return smalltalk.withContext(function($ctx2) {
  410. return _st(a).__plus(b);
  411. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)})}))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  412. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},smalltalk.BlockClosureTest)})},
  413. args: [],
  414. source: "testValueWithPossibleArguments\x0a\x09self assert: ([ 1 ] valueWithPossibleArguments: #(3 4)) equals: 1.\x0a\x09self assert: ([ :a | a + 4 ] valueWithPossibleArguments: #(3 4)) equals: 7.\x0a\x09self assert: ([ :a :b | a + b ] valueWithPossibleArguments: #(3 4 5)) equals: 7.",
  415. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"],
  416. referencedClasses: []
  417. }),
  418. smalltalk.BlockClosureTest);
  419. smalltalk.addMethod(
  420. smalltalk.method({
  421. selector: "testWhileFalse",
  422. protocol: 'tests',
  423. fn: function (){
  424. var self=this;
  425. var i;
  426. return smalltalk.withContext(function($ctx1) {
  427. i=(0);
  428. _st((function(){
  429. return smalltalk.withContext(function($ctx2) {
  430. return _st(i).__gt((5));
  431. $ctx2.sendIdx[">"]=1;
  432. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileFalse_((function(){
  433. return smalltalk.withContext(function($ctx2) {
  434. i=_st(i).__plus((1));
  435. $ctx2.sendIdx["+"]=1;
  436. return i;
  437. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  438. self._assert_equals_(i,(6));
  439. $ctx1.sendIdx["assert:equals:"]=1;
  440. i=(0);
  441. _st((function(){
  442. return smalltalk.withContext(function($ctx2) {
  443. i=_st(i).__plus((1));
  444. i;
  445. return _st(i).__gt((5));
  446. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileFalse();
  447. self._assert_equals_(i,(6));
  448. return self}, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},smalltalk.BlockClosureTest)})},
  449. args: [],
  450. source: "testWhileFalse\x0a\x09| i |\x0a\x09i := 0.\x0a\x09[ i > 5 ] whileFalse: [ i := i + 1 ].\x0a\x09self assert: i equals: 6.\x0a\x0a\x09i := 0.\x0a\x09[ i := i + 1. i > 5 ] whileFalse.\x0a\x09self assert: i equals: 6",
  451. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"],
  452. referencedClasses: []
  453. }),
  454. smalltalk.BlockClosureTest);
  455. smalltalk.addMethod(
  456. smalltalk.method({
  457. selector: "testWhileTrue",
  458. protocol: 'tests',
  459. fn: function (){
  460. var self=this;
  461. var i;
  462. return smalltalk.withContext(function($ctx1) {
  463. i=(0);
  464. _st((function(){
  465. return smalltalk.withContext(function($ctx2) {
  466. return _st(i).__lt((5));
  467. $ctx2.sendIdx["<"]=1;
  468. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._whileTrue_((function(){
  469. return smalltalk.withContext(function($ctx2) {
  470. i=_st(i).__plus((1));
  471. $ctx2.sendIdx["+"]=1;
  472. return i;
  473. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  474. self._assert_equals_(i,(5));
  475. $ctx1.sendIdx["assert:equals:"]=1;
  476. i=(0);
  477. _st((function(){
  478. return smalltalk.withContext(function($ctx2) {
  479. i=_st(i).__plus((1));
  480. i;
  481. return _st(i).__lt((5));
  482. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._whileTrue();
  483. self._assert_equals_(i,(5));
  484. return self}, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},smalltalk.BlockClosureTest)})},
  485. args: [],
  486. source: "testWhileTrue\x0a\x09| i |\x0a\x09i := 0.\x0a\x09[ i < 5 ] whileTrue: [ i := i + 1 ].\x0a\x09self assert: i equals: 5.\x0a\x0a\x09i := 0.\x0a\x09[ i := i + 1. i < 5 ] whileTrue.\x0a\x09self assert: i equals: 5",
  487. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"],
  488. referencedClasses: []
  489. }),
  490. smalltalk.BlockClosureTest);
  491. smalltalk.addClass('BooleanTest', smalltalk.TestCase, [], 'Kernel-Tests');
  492. smalltalk.addMethod(
  493. smalltalk.method({
  494. selector: "testEquality",
  495. protocol: 'tests',
  496. fn: function (){
  497. var self=this;
  498. return smalltalk.withContext(function($ctx1) {
  499. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  500. $1=(0).__eq(false);
  501. $ctx1.sendIdx["="]=1;
  502. self._deny_($1);
  503. $ctx1.sendIdx["deny:"]=1;
  504. $2=false.__eq((0));
  505. $ctx1.sendIdx["="]=2;
  506. self._deny_($2);
  507. $ctx1.sendIdx["deny:"]=2;
  508. $3="".__eq(false);
  509. $ctx1.sendIdx["="]=3;
  510. self._deny_($3);
  511. $ctx1.sendIdx["deny:"]=3;
  512. $4=false.__eq("");
  513. $ctx1.sendIdx["="]=4;
  514. self._deny_($4);
  515. $ctx1.sendIdx["deny:"]=4;
  516. $5=true.__eq(true);
  517. $ctx1.sendIdx["="]=5;
  518. self._assert_($5);
  519. $ctx1.sendIdx["assert:"]=1;
  520. $6=false.__eq(true);
  521. $ctx1.sendIdx["="]=6;
  522. self._deny_($6);
  523. $ctx1.sendIdx["deny:"]=5;
  524. $7=true.__eq(false);
  525. $ctx1.sendIdx["="]=7;
  526. self._deny_($7);
  527. $8=false.__eq(false);
  528. $ctx1.sendIdx["="]=8;
  529. self._assert_($8);
  530. $ctx1.sendIdx["assert:"]=2;
  531. $10=true._yourself();
  532. $ctx1.sendIdx["yourself"]=1;
  533. $9=_st($10).__eq(true);
  534. $ctx1.sendIdx["="]=9;
  535. self._assert_($9);
  536. $ctx1.sendIdx["assert:"]=3;
  537. $12=true._yourself();
  538. $ctx1.sendIdx["yourself"]=2;
  539. $11=_st($12).__eq(true._yourself());
  540. self._assert_($11);
  541. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.BooleanTest)})},
  542. args: [],
  543. source: "testEquality\x0a\x09\x22We're on top of JS...just be sure to check the basics!\x22\x0a\x0a\x09self deny: 0 = false.\x0a\x09self deny: false = 0.\x0a\x09self deny: '' = false.\x0a\x09self deny: false = ''.\x0a\x0a\x09self assert: (true = true).\x0a\x09self deny: false = true.\x0a\x09self deny: true = false.\x0a\x09self assert: (false = false).\x0a\x0a\x09\x22JS may do some type coercing after sending a message\x22\x0a\x09self assert: (true yourself = true).\x0a\x09self assert: (true yourself = true yourself)",
  544. messageSends: ["deny:", "=", "assert:", "yourself"],
  545. referencedClasses: []
  546. }),
  547. smalltalk.BooleanTest);
  548. smalltalk.addMethod(
  549. smalltalk.method({
  550. selector: "testIdentity",
  551. protocol: 'tests',
  552. fn: function (){
  553. var self=this;
  554. return smalltalk.withContext(function($ctx1) {
  555. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  556. $1=(0).__eq_eq(false);
  557. $ctx1.sendIdx["=="]=1;
  558. self._deny_($1);
  559. $ctx1.sendIdx["deny:"]=1;
  560. $2=false.__eq_eq((0));
  561. $ctx1.sendIdx["=="]=2;
  562. self._deny_($2);
  563. $ctx1.sendIdx["deny:"]=2;
  564. $3="".__eq_eq(false);
  565. $ctx1.sendIdx["=="]=3;
  566. self._deny_($3);
  567. $ctx1.sendIdx["deny:"]=3;
  568. $4=false.__eq_eq("");
  569. $ctx1.sendIdx["=="]=4;
  570. self._deny_($4);
  571. $ctx1.sendIdx["deny:"]=4;
  572. $5=true.__eq_eq(true);
  573. $ctx1.sendIdx["=="]=5;
  574. self._assert_($5);
  575. $ctx1.sendIdx["assert:"]=1;
  576. $6=false.__eq_eq(true);
  577. $ctx1.sendIdx["=="]=6;
  578. self._deny_($6);
  579. $ctx1.sendIdx["deny:"]=5;
  580. $7=true.__eq_eq(false);
  581. $ctx1.sendIdx["=="]=7;
  582. self._deny_($7);
  583. $8=false.__eq_eq(false);
  584. $ctx1.sendIdx["=="]=8;
  585. self._assert_($8);
  586. $ctx1.sendIdx["assert:"]=2;
  587. $10=true._yourself();
  588. $ctx1.sendIdx["yourself"]=1;
  589. $9=_st($10).__eq_eq(true);
  590. $ctx1.sendIdx["=="]=9;
  591. self._assert_($9);
  592. $ctx1.sendIdx["assert:"]=3;
  593. $12=true._yourself();
  594. $ctx1.sendIdx["yourself"]=2;
  595. $11=_st($12).__eq_eq(true._yourself());
  596. self._assert_($11);
  597. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.BooleanTest)})},
  598. args: [],
  599. source: "testIdentity\x0a\x09\x22We're on top of JS...just be sure to check the basics!\x22\x0a\x0a\x09self deny: 0 == false.\x0a\x09self deny: false == 0.\x0a\x09self deny: '' == false.\x0a\x09self deny: false == ''.\x0a\x0a\x09self assert: true == true.\x0a\x09self deny: false == true.\x0a\x09self deny: true == false.\x0a\x09self assert: false == false.\x0a\x0a\x09\x22JS may do some type coercing after sending a message\x22\x0a\x09self assert: true yourself == true.\x0a\x09self assert: true yourself == true yourself",
  600. messageSends: ["deny:", "==", "assert:", "yourself"],
  601. referencedClasses: []
  602. }),
  603. smalltalk.BooleanTest);
  604. smalltalk.addMethod(
  605. smalltalk.method({
  606. selector: "testIfTrueIfFalse",
  607. protocol: 'tests',
  608. fn: function (){
  609. var self=this;
  610. return smalltalk.withContext(function($ctx1) {
  611. var $1,$2,$3,$4,$5,$6,$7,$8;
  612. if(smalltalk.assert(true)){
  613. $1="alternative block";
  614. };
  615. self._assert_equals_($1,"alternative block");
  616. $ctx1.sendIdx["assert:equals:"]=1;
  617. if(! smalltalk.assert(true)){
  618. $2="alternative block";
  619. };
  620. self._assert_equals_($2,nil);
  621. $ctx1.sendIdx["assert:equals:"]=2;
  622. if(smalltalk.assert(false)){
  623. $3="alternative block";
  624. };
  625. self._assert_equals_($3,nil);
  626. $ctx1.sendIdx["assert:equals:"]=3;
  627. if(! smalltalk.assert(false)){
  628. $4="alternative block";
  629. };
  630. self._assert_equals_($4,"alternative block");
  631. $ctx1.sendIdx["assert:equals:"]=4;
  632. if(smalltalk.assert(false)){
  633. $5="alternative block";
  634. } else {
  635. $5="alternative block2";
  636. };
  637. self._assert_equals_($5,"alternative block2");
  638. $ctx1.sendIdx["assert:equals:"]=5;
  639. if(smalltalk.assert(false)){
  640. $6="alternative block2";
  641. } else {
  642. $6="alternative block";
  643. };
  644. self._assert_equals_($6,"alternative block");
  645. $ctx1.sendIdx["assert:equals:"]=6;
  646. if(smalltalk.assert(true)){
  647. $7="alternative block";
  648. } else {
  649. $7="alternative block2";
  650. };
  651. self._assert_equals_($7,"alternative block");
  652. $ctx1.sendIdx["assert:equals:"]=7;
  653. if(smalltalk.assert(true)){
  654. $8="alternative block2";
  655. } else {
  656. $8="alternative block";
  657. };
  658. self._assert_equals_($8,"alternative block2");
  659. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},smalltalk.BooleanTest)})},
  660. args: [],
  661. source: "testIfTrueIfFalse\x0a\x0a\x09self assert: (true ifTrue: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x09self assert: (true ifFalse: [ 'alternative block' ]) equals: nil.\x0a\x0a\x09self assert: (false ifTrue: [ 'alternative block' ]) equals: nil.\x0a\x09self assert: (false ifFalse: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (false ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block2'.\x0a\x09self assert: (false ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (true ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x09self assert: (true ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block2'.",
  662. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  663. referencedClasses: []
  664. }),
  665. smalltalk.BooleanTest);
  666. smalltalk.addMethod(
  667. smalltalk.method({
  668. selector: "testIfTrueIfFalseWithBoxing",
  669. protocol: 'tests',
  670. fn: function (){
  671. var self=this;
  672. return smalltalk.withContext(function($ctx1) {
  673. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  674. $2=true._yourself();
  675. $ctx1.sendIdx["yourself"]=1;
  676. if(smalltalk.assert($2)){
  677. $1="alternative block";
  678. };
  679. self._assert_equals_($1,"alternative block");
  680. $ctx1.sendIdx["assert:equals:"]=1;
  681. $4=true._yourself();
  682. $ctx1.sendIdx["yourself"]=2;
  683. if(! smalltalk.assert($4)){
  684. $3="alternative block";
  685. };
  686. self._assert_equals_($3,nil);
  687. $ctx1.sendIdx["assert:equals:"]=2;
  688. $6=false._yourself();
  689. $ctx1.sendIdx["yourself"]=3;
  690. if(smalltalk.assert($6)){
  691. $5="alternative block";
  692. };
  693. self._assert_equals_($5,nil);
  694. $ctx1.sendIdx["assert:equals:"]=3;
  695. $8=false._yourself();
  696. $ctx1.sendIdx["yourself"]=4;
  697. if(! smalltalk.assert($8)){
  698. $7="alternative block";
  699. };
  700. self._assert_equals_($7,"alternative block");
  701. $ctx1.sendIdx["assert:equals:"]=4;
  702. $10=false._yourself();
  703. $ctx1.sendIdx["yourself"]=5;
  704. if(smalltalk.assert($10)){
  705. $9="alternative block";
  706. } else {
  707. $9="alternative block2";
  708. };
  709. self._assert_equals_($9,"alternative block2");
  710. $ctx1.sendIdx["assert:equals:"]=5;
  711. $12=false._yourself();
  712. $ctx1.sendIdx["yourself"]=6;
  713. if(smalltalk.assert($12)){
  714. $11="alternative block2";
  715. } else {
  716. $11="alternative block";
  717. };
  718. self._assert_equals_($11,"alternative block");
  719. $ctx1.sendIdx["assert:equals:"]=6;
  720. $14=true._yourself();
  721. $ctx1.sendIdx["yourself"]=7;
  722. if(smalltalk.assert($14)){
  723. $13="alternative block";
  724. } else {
  725. $13="alternative block2";
  726. };
  727. self._assert_equals_($13,"alternative block");
  728. $ctx1.sendIdx["assert:equals:"]=7;
  729. $16=true._yourself();
  730. if(smalltalk.assert($16)){
  731. $15="alternative block2";
  732. } else {
  733. $15="alternative block";
  734. };
  735. self._assert_equals_($15,"alternative block2");
  736. return self}, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},smalltalk.BooleanTest)})},
  737. args: [],
  738. source: "testIfTrueIfFalseWithBoxing\x0a\x0a\x09self assert: (true yourself ifTrue: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: [ 'alternative block' ]) equals: nil.\x0a\x0a\x09self assert: (false yourself ifTrue: [ 'alternative block' ]) equals: nil.\x0a\x09self assert: (false yourself ifFalse: [ 'alternative block' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (false yourself ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block2'.\x0a\x09self assert: (false yourself ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x0a\x09self assert: (true yourself ifTrue: [ 'alternative block' ] ifFalse: [ 'alternative block2' ]) equals: 'alternative block'.\x0a\x09self assert: (true yourself ifFalse: [ 'alternative block' ] ifTrue: [ 'alternative block2' ]) equals: 'alternative block2'.",
  739. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"],
  740. referencedClasses: []
  741. }),
  742. smalltalk.BooleanTest);
  743. smalltalk.addMethod(
  744. smalltalk.method({
  745. selector: "testLogic",
  746. protocol: 'tests',
  747. fn: function (){
  748. var self=this;
  749. return smalltalk.withContext(function($ctx1) {
  750. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$17,$18,$16,$15,$20,$19,$22,$21,$25,$24,$23;
  751. $1=true.__and(true);
  752. $ctx1.sendIdx["&"]=1;
  753. self._assert_($1);
  754. $ctx1.sendIdx["assert:"]=1;
  755. $2=true.__and(false);
  756. $ctx1.sendIdx["&"]=2;
  757. self._deny_($2);
  758. $ctx1.sendIdx["deny:"]=1;
  759. $3=false.__and(true);
  760. $ctx1.sendIdx["&"]=3;
  761. self._deny_($3);
  762. $ctx1.sendIdx["deny:"]=2;
  763. $5=false.__and(false);
  764. $ctx1.sendIdx["&"]=4;
  765. $4=self._deny_($5);
  766. $ctx1.sendIdx["deny:"]=3;
  767. $6=true.__or(true);
  768. $ctx1.sendIdx["|"]=1;
  769. self._assert_($6);
  770. $ctx1.sendIdx["assert:"]=2;
  771. $7=true.__or(false);
  772. $ctx1.sendIdx["|"]=2;
  773. self._assert_($7);
  774. $ctx1.sendIdx["assert:"]=3;
  775. $8=false.__or(true);
  776. $ctx1.sendIdx["|"]=3;
  777. self._assert_($8);
  778. $ctx1.sendIdx["assert:"]=4;
  779. $10=false.__or(false);
  780. $ctx1.sendIdx["|"]=4;
  781. $9=self._deny_($10);
  782. $ctx1.sendIdx["deny:"]=4;
  783. $12=(1).__gt((0));
  784. $ctx1.sendIdx[">"]=1;
  785. $11=true.__and($12);
  786. $ctx1.sendIdx["&"]=5;
  787. self._assert_($11);
  788. $ctx1.sendIdx["assert:"]=5;
  789. $14=(1).__gt((0));
  790. $ctx1.sendIdx[">"]=2;
  791. $13=_st($14).__and(false);
  792. $ctx1.sendIdx["&"]=6;
  793. self._deny_($13);
  794. $ctx1.sendIdx["deny:"]=5;
  795. $17=(1).__gt((0));
  796. $ctx1.sendIdx[">"]=3;
  797. $18=(1).__gt((2));
  798. $ctx1.sendIdx[">"]=4;
  799. $16=_st($17).__and($18);
  800. $15=self._deny_($16);
  801. $20=(1).__gt((0));
  802. $ctx1.sendIdx[">"]=5;
  803. $19=false.__or($20);
  804. $ctx1.sendIdx["|"]=5;
  805. self._assert_($19);
  806. $ctx1.sendIdx["assert:"]=6;
  807. $22=(1).__gt((0));
  808. $ctx1.sendIdx[">"]=6;
  809. $21=_st($22).__or(false);
  810. $ctx1.sendIdx["|"]=6;
  811. self._assert_($21);
  812. $ctx1.sendIdx["assert:"]=7;
  813. $25=(1).__gt((0));
  814. $ctx1.sendIdx[">"]=7;
  815. $24=_st($25).__or((1).__gt((2)));
  816. $23=self._assert_($24);
  817. return self}, function($ctx1) {$ctx1.fill(self,"testLogic",{},smalltalk.BooleanTest)})},
  818. args: [],
  819. source: "testLogic\x0a\x09\x22Trivial logic table\x22\x0a\x09self assert: (true & true);\x0a\x09\x09deny: (true & false);\x0a\x09\x09deny: (false & true);\x0a\x09\x09deny: (false & false).\x0a\x09self assert: (true | true);\x0a\x09\x09assert: (true | false);\x0a\x09\x09assert: (false | true);\x0a\x09\x09deny: (false | false).\x0a\x09\x22Checking that expressions work fine too\x22\x0a\x09self assert: (true & (1 > 0));\x0a\x09\x09deny: ((1 > 0) & false);\x0a\x09\x09deny: ((1 > 0) & (1 > 2)).\x0a\x09self assert: (false | (1 > 0));\x0a\x09\x09assert: ((1 > 0) | false);\x0a\x09\x09assert: ((1 > 0) | (1 > 2))",
  820. messageSends: ["assert:", "&", "deny:", "|", ">"],
  821. referencedClasses: []
  822. }),
  823. smalltalk.BooleanTest);
  824. smalltalk.addMethod(
  825. smalltalk.method({
  826. selector: "testLogicKeywords",
  827. protocol: 'tests',
  828. fn: function (){
  829. var self=this;
  830. return smalltalk.withContext(function($ctx1) {
  831. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$16,$15,$14,$17,$19,$18,$22,$21,$20;
  832. $1=true._and_((function(){
  833. return smalltalk.withContext(function($ctx2) {
  834. return true;
  835. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  836. $ctx1.sendIdx["and:"]=1;
  837. self._assert_($1);
  838. $ctx1.sendIdx["assert:"]=1;
  839. $2=true._and_((function(){
  840. return smalltalk.withContext(function($ctx2) {
  841. return false;
  842. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  843. $ctx1.sendIdx["and:"]=2;
  844. self._deny_($2);
  845. $ctx1.sendIdx["deny:"]=1;
  846. $3=false._and_((function(){
  847. return smalltalk.withContext(function($ctx2) {
  848. return true;
  849. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  850. $ctx1.sendIdx["and:"]=3;
  851. self._deny_($3);
  852. $ctx1.sendIdx["deny:"]=2;
  853. $5=false._and_((function(){
  854. return smalltalk.withContext(function($ctx2) {
  855. return false;
  856. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  857. $ctx1.sendIdx["and:"]=4;
  858. $4=self._deny_($5);
  859. $ctx1.sendIdx["deny:"]=3;
  860. $6=true._or_((function(){
  861. return smalltalk.withContext(function($ctx2) {
  862. return true;
  863. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  864. $ctx1.sendIdx["or:"]=1;
  865. self._assert_($6);
  866. $ctx1.sendIdx["assert:"]=2;
  867. $7=true._or_((function(){
  868. return smalltalk.withContext(function($ctx2) {
  869. return false;
  870. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  871. $ctx1.sendIdx["or:"]=2;
  872. self._assert_($7);
  873. $ctx1.sendIdx["assert:"]=3;
  874. $8=false._or_((function(){
  875. return smalltalk.withContext(function($ctx2) {
  876. return true;
  877. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}));
  878. $ctx1.sendIdx["or:"]=3;
  879. self._assert_($8);
  880. $ctx1.sendIdx["assert:"]=4;
  881. $10=false._or_((function(){
  882. return smalltalk.withContext(function($ctx2) {
  883. return false;
  884. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  885. $ctx1.sendIdx["or:"]=4;
  886. $9=self._deny_($10);
  887. $ctx1.sendIdx["deny:"]=4;
  888. $11=true._and_((function(){
  889. return smalltalk.withContext(function($ctx2) {
  890. return (1).__gt((0));
  891. $ctx2.sendIdx[">"]=1;
  892. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}));
  893. $ctx1.sendIdx["and:"]=5;
  894. self._assert_($11);
  895. $ctx1.sendIdx["assert:"]=5;
  896. $13=(1).__gt((0));
  897. $ctx1.sendIdx[">"]=2;
  898. $12=_st($13)._and_((function(){
  899. return smalltalk.withContext(function($ctx2) {
  900. return false;
  901. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}));
  902. $ctx1.sendIdx["and:"]=6;
  903. self._deny_($12);
  904. $ctx1.sendIdx["deny:"]=5;
  905. $16=(1).__gt((0));
  906. $ctx1.sendIdx[">"]=3;
  907. $15=_st($16)._and_((function(){
  908. return smalltalk.withContext(function($ctx2) {
  909. return (1).__gt((2));
  910. $ctx2.sendIdx[">"]=4;
  911. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}));
  912. $14=self._deny_($15);
  913. $17=false._or_((function(){
  914. return smalltalk.withContext(function($ctx2) {
  915. return (1).__gt((0));
  916. $ctx2.sendIdx[">"]=5;
  917. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}));
  918. $ctx1.sendIdx["or:"]=5;
  919. self._assert_($17);
  920. $ctx1.sendIdx["assert:"]=6;
  921. $19=(1).__gt((0));
  922. $ctx1.sendIdx[">"]=6;
  923. $18=_st($19)._or_((function(){
  924. return smalltalk.withContext(function($ctx2) {
  925. return false;
  926. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}));
  927. $ctx1.sendIdx["or:"]=6;
  928. self._assert_($18);
  929. $ctx1.sendIdx["assert:"]=7;
  930. $22=(1).__gt((0));
  931. $ctx1.sendIdx[">"]=7;
  932. $21=_st($22)._or_((function(){
  933. return smalltalk.withContext(function($ctx2) {
  934. return (1).__gt((2));
  935. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}));
  936. $20=self._assert_($21);
  937. return self}, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},smalltalk.BooleanTest)})},
  938. args: [],
  939. source: "testLogicKeywords\x0a\x09\x22Trivial logic table\x22\x0a\x09self\x0a\x09\x09assert: (true and: [ true ]);\x0a\x09\x09deny: (true and: [ false ]);\x0a\x09\x09deny: (false and: [ true ]);\x0a\x09\x09deny: (false and: [ false ]).\x0a\x09self\x0a\x09\x09assert: (true or: [ true ]);\x0a\x09\x09assert: (true or: [ false ]);\x0a\x09\x09assert: (false or: [ true ]);\x0a\x09\x09deny: (false or: [ false ]).\x0a\x09\x09\x0a\x09\x22Checking that expressions work fine too\x22\x0a\x09self\x0a\x09\x09assert: (true and: [ 1 > 0 ]);\x0a\x09\x09deny: ((1 > 0) and: [ false ]);\x0a\x09\x09deny: ((1 > 0) and: [ 1 > 2 ]).\x0a\x09self\x0a\x09\x09assert: (false or: [ 1 > 0 ]);\x0a\x09\x09assert: ((1 > 0) or: [ false ]);\x0a\x09\x09assert: ((1 > 0) or: [ 1 > 2 ])",
  940. messageSends: ["assert:", "and:", "deny:", "or:", ">"],
  941. referencedClasses: []
  942. }),
  943. smalltalk.BooleanTest);
  944. smalltalk.addMethod(
  945. smalltalk.method({
  946. selector: "testNonBooleanError",
  947. protocol: 'tests',
  948. fn: function (){
  949. var self=this;
  950. function $NonBooleanReceiver(){return smalltalk.NonBooleanReceiver||(typeof NonBooleanReceiver=="undefined"?nil:NonBooleanReceiver)}
  951. return smalltalk.withContext(function($ctx1) {
  952. self._should_raise_((function(){
  953. return smalltalk.withContext(function($ctx2) {
  954. if(smalltalk.assert("")){
  955. } else {
  956. };
  957. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$NonBooleanReceiver());
  958. return self}, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},smalltalk.BooleanTest)})},
  959. args: [],
  960. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  961. messageSends: ["should:raise:", "ifTrue:ifFalse:"],
  962. referencedClasses: ["NonBooleanReceiver"]
  963. }),
  964. smalltalk.BooleanTest);
  965. smalltalk.addClass('ClassBuilderTest', smalltalk.TestCase, ['builder', 'theClass'], 'Kernel-Tests');
  966. smalltalk.addMethod(
  967. smalltalk.method({
  968. selector: "setUp",
  969. protocol: 'running',
  970. fn: function (){
  971. var self=this;
  972. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  973. return smalltalk.withContext(function($ctx1) {
  974. self["@builder"]=_st($ClassBuilder())._new();
  975. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.ClassBuilderTest)})},
  976. args: [],
  977. source: "setUp\x0a\x09builder := ClassBuilder new",
  978. messageSends: ["new"],
  979. referencedClasses: ["ClassBuilder"]
  980. }),
  981. smalltalk.ClassBuilderTest);
  982. smalltalk.addMethod(
  983. smalltalk.method({
  984. selector: "tearDown",
  985. protocol: 'running',
  986. fn: function (){
  987. var self=this;
  988. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  989. return smalltalk.withContext(function($ctx1) {
  990. var $1;
  991. $1=self["@theClass"];
  992. if(($receiver = $1) == nil || $receiver == null){
  993. $1;
  994. } else {
  995. _st(_st($Smalltalk())._current())._removeClass_(self["@theClass"]);
  996. self["@theClass"]=nil;
  997. self["@theClass"];
  998. };
  999. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.ClassBuilderTest)})},
  1000. args: [],
  1001. source: "tearDown\x0a\x09theClass ifNotNil: [ Smalltalk current removeClass: theClass. theClass := nil ]",
  1002. messageSends: ["ifNotNil:", "removeClass:", "current"],
  1003. referencedClasses: ["Smalltalk"]
  1004. }),
  1005. smalltalk.ClassBuilderTest);
  1006. smalltalk.addMethod(
  1007. smalltalk.method({
  1008. selector: "testClassCopy",
  1009. protocol: 'tests',
  1010. fn: function (){
  1011. var self=this;
  1012. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1013. return smalltalk.withContext(function($ctx1) {
  1014. var $2,$1,$4,$3,$6,$5,$8,$7;
  1015. self["@theClass"]=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1016. $2=_st(self["@theClass"])._superclass();
  1017. $ctx1.sendIdx["superclass"]=1;
  1018. $1=_st($2).__eq_eq(_st($ObjectMock())._superclass());
  1019. $ctx1.sendIdx["=="]=1;
  1020. self._assert_($1);
  1021. $ctx1.sendIdx["assert:"]=1;
  1022. $4=_st(self["@theClass"])._instanceVariableNames();
  1023. $ctx1.sendIdx["instanceVariableNames"]=1;
  1024. $3=_st($4).__eq_eq(_st($ObjectMock())._instanceVariableNames());
  1025. $ctx1.sendIdx["=="]=2;
  1026. self._assert_($3);
  1027. $ctx1.sendIdx["assert:"]=2;
  1028. self._assert_equals_(_st(self["@theClass"])._name(),"ObjectMock2");
  1029. $ctx1.sendIdx["assert:equals:"]=1;
  1030. $6=_st(self["@theClass"])._package();
  1031. $ctx1.sendIdx["package"]=1;
  1032. $5=_st($6).__eq_eq(_st($ObjectMock())._package());
  1033. self._assert_($5);
  1034. $8=_st(self["@theClass"])._methodDictionary();
  1035. $ctx1.sendIdx["methodDictionary"]=1;
  1036. $7=_st($8)._keys();
  1037. $ctx1.sendIdx["keys"]=1;
  1038. self._assert_equals_($7,_st(_st($ObjectMock())._methodDictionary())._keys());
  1039. return self}, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},smalltalk.ClassBuilderTest)})},
  1040. args: [],
  1041. source: "testClassCopy\x0a\x09theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09self assert: theClass superclass == ObjectMock superclass.\x0a\x09self assert: theClass instanceVariableNames == ObjectMock instanceVariableNames.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: theClass package == ObjectMock package.\x0a\x09self assert: theClass methodDictionary keys equals: ObjectMock methodDictionary keys",
  1042. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary"],
  1043. referencedClasses: ["ObjectMock"]
  1044. }),
  1045. smalltalk.ClassBuilderTest);
  1046. smalltalk.addMethod(
  1047. smalltalk.method({
  1048. selector: "testClassMigration",
  1049. protocol: 'tests',
  1050. fn: function (){
  1051. var self=this;
  1052. var instance,oldClass;
  1053. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1054. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1055. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1056. return smalltalk.withContext(function($ctx1) {
  1057. var $2,$1,$4,$3,$5,$6,$7,$8,$9,$11,$10,$14,$13,$12;
  1058. oldClass=_st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1059. $2=_st($Smalltalk())._current();
  1060. $ctx1.sendIdx["current"]=1;
  1061. $1=_st($2)._at_("ObjectMock2");
  1062. $ctx1.sendIdx["at:"]=1;
  1063. instance=_st($1)._new();
  1064. $4=_st($Smalltalk())._current();
  1065. $ctx1.sendIdx["current"]=2;
  1066. $3=_st($4)._at_("ObjectMock2");
  1067. $ctx1.sendIdx["at:"]=2;
  1068. _st($ObjectMock())._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  1069. $5=_st(oldClass).__eq_eq($ObjectMock2());
  1070. $ctx1.sendIdx["=="]=1;
  1071. self._deny_($5);
  1072. $ctx1.sendIdx["deny:"]=1;
  1073. $6=_st(_st($ObjectMock2())._superclass()).__eq_eq($ObjectMock());
  1074. $ctx1.sendIdx["=="]=2;
  1075. self._assert_($6);
  1076. $ctx1.sendIdx["assert:"]=1;
  1077. self._assert_(_st(_st($ObjectMock2())._instanceVariableNames())._isEmpty());
  1078. $ctx1.sendIdx["assert:"]=2;
  1079. $7=_st($ObjectMock2())._selectors();
  1080. $ctx1.sendIdx["selectors"]=1;
  1081. self._assert_equals_($7,_st(oldClass)._selectors());
  1082. $ctx1.sendIdx["assert:equals:"]=1;
  1083. $8=_st($ObjectMock2())._comment();
  1084. $ctx1.sendIdx["comment"]=1;
  1085. self._assert_equals_($8,_st(oldClass)._comment());
  1086. $ctx1.sendIdx["assert:equals:"]=2;
  1087. $9=_st(_st($ObjectMock2())._package())._name();
  1088. $ctx1.sendIdx["name"]=1;
  1089. self._assert_equals_($9,"Kernel-Tests");
  1090. $11=_st(instance)._class();
  1091. $ctx1.sendIdx["class"]=1;
  1092. $10=_st($11).__eq_eq($ObjectMock2());
  1093. self._deny_($10);
  1094. $14=_st($Smalltalk())._current();
  1095. $ctx1.sendIdx["current"]=3;
  1096. $13=_st($14)._at_(_st(_st(instance)._class())._name());
  1097. $12=_st($13)._isNil();
  1098. self._assert_($12);
  1099. _st(_st($Smalltalk())._current())._removeClass_($ObjectMock2());
  1100. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},smalltalk.ClassBuilderTest)})},
  1101. args: [],
  1102. source: "testClassMigration\x0a\x09| instance oldClass |\x0a\x09\x0a\x09oldClass := builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09instance := (Smalltalk current at: 'ObjectMock2') new.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: oldClass == ObjectMock2.\x0a\x09\x0a\x09self assert: ObjectMock2 superclass == ObjectMock.\x0a\x09self assert: ObjectMock2 instanceVariableNames isEmpty.\x0a\x09self assert: ObjectMock2 selectors equals: oldClass selectors.\x0a\x09self assert: ObjectMock2 comment equals: oldClass comment.\x0a\x09self assert: ObjectMock2 package name equals: 'Kernel-Tests'.\x0a\x09\x0a\x09self deny: instance class == ObjectMock2.\x0a\x09\x22Commeting this out. Tests implementation detail.\x22\x0a\x09\x22self assert: instance class name equals: 'OldObjectMock2'.\x22\x0a\x09\x0a\x09self assert: (Smalltalk current at: instance class name) isNil.\x0a\x09\x0a\x09Smalltalk current removeClass: ObjectMock2",
  1103. messageSends: ["copyClass:named:", "new", "at:", "current", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "class", "isNil", "removeClass:"],
  1104. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"]
  1105. }),
  1106. smalltalk.ClassBuilderTest);
  1107. smalltalk.addMethod(
  1108. smalltalk.method({
  1109. selector: "testClassMigrationWithClassInstanceVariables",
  1110. protocol: 'tests',
  1111. fn: function (){
  1112. var self=this;
  1113. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1114. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1115. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1116. return smalltalk.withContext(function($ctx1) {
  1117. var $1,$3,$2;
  1118. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1119. $1=_st($ObjectMock2())._class();
  1120. $ctx1.sendIdx["class"]=1;
  1121. _st($1)._instanceVariableNames_("foo bar");
  1122. $3=_st($Smalltalk())._current();
  1123. $ctx1.sendIdx["current"]=1;
  1124. $2=_st($3)._at_("ObjectMock2");
  1125. _st($ObjectMock())._subclass_instanceVariableNames_package_($2,"","Kernel-Tests");
  1126. self._assert_equals_(_st(_st($ObjectMock2())._class())._instanceVariableNames(),["foo", "bar"]);
  1127. _st(_st($Smalltalk())._current())._removeClass_($ObjectMock2());
  1128. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},smalltalk.ClassBuilderTest)})},
  1129. args: [],
  1130. source: "testClassMigrationWithClassInstanceVariables\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 class instanceVariableNames: 'foo bar'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: ObjectMock2 class instanceVariableNames equals: #('foo' 'bar').\x0a\x09\x0a\x09Smalltalk current removeClass: ObjectMock2",
  1131. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "current", "assert:equals:", "instanceVariableNames", "removeClass:"],
  1132. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"]
  1133. }),
  1134. smalltalk.ClassBuilderTest);
  1135. smalltalk.addMethod(
  1136. smalltalk.method({
  1137. selector: "testClassMigrationWithSubclasses",
  1138. protocol: 'tests',
  1139. fn: function (){
  1140. var self=this;
  1141. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  1142. function $ObjectMock2(){return smalltalk.ObjectMock2||(typeof ObjectMock2=="undefined"?nil:ObjectMock2)}
  1143. function $ObjectMock3(){return smalltalk.ObjectMock3||(typeof ObjectMock3=="undefined"?nil:ObjectMock3)}
  1144. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  1145. function $ObjectMock4(){return smalltalk.ObjectMock4||(typeof ObjectMock4=="undefined"?nil:ObjectMock4)}
  1146. return smalltalk.withContext(function($ctx1) {
  1147. var $2,$1,$4,$3,$6,$5;
  1148. _st(self["@builder"])._copyClass_named_($ObjectMock(),"ObjectMock2");
  1149. _st($ObjectMock2())._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  1150. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  1151. _st($ObjectMock3())._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  1152. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  1153. $2=_st($Smalltalk())._current();
  1154. $ctx1.sendIdx["current"]=1;
  1155. $1=_st($2)._at_("ObjectMock2");
  1156. _st($ObjectMock())._subclass_instanceVariableNames_package_($1,"","Kernel-Tests");
  1157. $4=_st($ObjectMock())._subclasses();
  1158. $ctx1.sendIdx["subclasses"]=1;
  1159. $3=_st($4)._includes_($ObjectMock2());
  1160. $ctx1.sendIdx["includes:"]=1;
  1161. self._assert_($3);
  1162. $ctx1.sendIdx["assert:"]=1;
  1163. $6=_st($ObjectMock2())._subclasses();
  1164. $ctx1.sendIdx["subclasses"]=2;
  1165. $5=_st($6)._includes_($ObjectMock3());
  1166. $ctx1.sendIdx["includes:"]=2;
  1167. self._assert_($5);
  1168. $ctx1.sendIdx["assert:"]=2;
  1169. self._assert_(_st(_st($ObjectMock3())._subclasses())._includes_($ObjectMock4()));
  1170. _st(_st($ObjectMock())._allSubclasses())._do_((function(each){
  1171. return smalltalk.withContext(function($ctx2) {
  1172. return _st(_st($Smalltalk())._current())._removeClass_(each);
  1173. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1174. return self}, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},smalltalk.ClassBuilderTest)})},
  1175. args: [],
  1176. source: "testClassMigrationWithSubclasses\x0a\x09\x0a\x09builder copyClass: ObjectMock named: 'ObjectMock2'.\x0a\x09ObjectMock2 subclass: 'ObjectMock3' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09ObjectMock3 subclass: 'ObjectMock4' instanceVariableNames: '' package: 'Kernel-Tests'.\x0a\x09\x0a\x09\x22Change the superclass of ObjectMock2\x22\x0a\x09ObjectMock subclass: (Smalltalk current at: 'ObjectMock2')\x0a\x09\x09instanceVariableNames: ''\x0a\x09\x09package: 'Kernel-Tests'.\x0a\x09\x0a\x09self assert: (ObjectMock subclasses includes: ObjectMock2).\x0a\x09self assert: (ObjectMock2 subclasses includes: ObjectMock3).\x0a\x09self assert: (ObjectMock3 subclasses includes: ObjectMock4).\x0a\x09\x0a\x09ObjectMock allSubclasses do: [ :each | Smalltalk current removeClass: each ]",
  1177. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "current", "assert:", "includes:", "subclasses", "do:", "allSubclasses", "removeClass:"],
  1178. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"]
  1179. }),
  1180. smalltalk.ClassBuilderTest);
  1181. smalltalk.addMethod(
  1182. smalltalk.method({
  1183. selector: "testInstanceVariableNames",
  1184. protocol: 'tests',
  1185. fn: function (){
  1186. var self=this;
  1187. return smalltalk.withContext(function($ctx1) {
  1188. self._assert_equals_(_st(self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  1189. return self}, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},smalltalk.ClassBuilderTest)})},
  1190. args: [],
  1191. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  1192. messageSends: ["assert:equals:", "instanceVariableNamesFor:"],
  1193. referencedClasses: []
  1194. }),
  1195. smalltalk.ClassBuilderTest);
  1196. smalltalk.addClass('CollectionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  1197. smalltalk.addMethod(
  1198. smalltalk.method({
  1199. selector: "assertSameContents:as:",
  1200. protocol: 'convenience',
  1201. fn: function (aCollection,anotherCollection){
  1202. var self=this;
  1203. return smalltalk.withContext(function($ctx1) {
  1204. var $2,$1,$4,$3;
  1205. $2=_st(aCollection)._size();
  1206. $ctx1.sendIdx["size"]=1;
  1207. $1=_st($2).__eq(_st(anotherCollection)._size());
  1208. $ctx1.sendIdx["="]=1;
  1209. self._assert_($1);
  1210. $ctx1.sendIdx["assert:"]=1;
  1211. _st(aCollection)._do_((function(each){
  1212. return smalltalk.withContext(function($ctx2) {
  1213. $4=_st(aCollection)._occurrencesOf_(each);
  1214. $ctx2.sendIdx["occurrencesOf:"]=1;
  1215. $3=_st($4).__eq(_st(anotherCollection)._occurrencesOf_(each));
  1216. return self._assert_($3);
  1217. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1218. return self}, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},smalltalk.CollectionTest)})},
  1219. args: ["aCollection", "anotherCollection"],
  1220. source: "assertSameContents: aCollection as: anotherCollection\x0a\x09self assert: (aCollection size = anotherCollection size).\x0a\x09aCollection do: [ :each |\x0a\x09\x09self assert: ((aCollection occurrencesOf: each) = (anotherCollection occurrencesOf: each)) ]",
  1221. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"],
  1222. referencedClasses: []
  1223. }),
  1224. smalltalk.CollectionTest);
  1225. smalltalk.addMethod(
  1226. smalltalk.method({
  1227. selector: "collection",
  1228. protocol: 'fixture',
  1229. fn: function (){
  1230. var self=this;
  1231. return smalltalk.withContext(function($ctx1) {
  1232. self._subclassResponsibility();
  1233. return self}, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.CollectionTest)})},
  1234. args: [],
  1235. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  1236. messageSends: ["subclassResponsibility"],
  1237. referencedClasses: []
  1238. }),
  1239. smalltalk.CollectionTest);
  1240. smalltalk.addMethod(
  1241. smalltalk.method({
  1242. selector: "collectionClass",
  1243. protocol: 'fixture',
  1244. fn: function (){
  1245. var self=this;
  1246. return smalltalk.withContext(function($ctx1) {
  1247. var $1;
  1248. $1=_st(self._class())._collectionClass();
  1249. return $1;
  1250. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest)})},
  1251. args: [],
  1252. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  1253. messageSends: ["collectionClass", "class"],
  1254. referencedClasses: []
  1255. }),
  1256. smalltalk.CollectionTest);
  1257. smalltalk.addMethod(
  1258. smalltalk.method({
  1259. selector: "collectionSize",
  1260. protocol: 'fixture',
  1261. fn: function (){
  1262. var self=this;
  1263. return smalltalk.withContext(function($ctx1) {
  1264. self._subclassResponsibility();
  1265. return self}, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.CollectionTest)})},
  1266. args: [],
  1267. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  1268. messageSends: ["subclassResponsibility"],
  1269. referencedClasses: []
  1270. }),
  1271. smalltalk.CollectionTest);
  1272. smalltalk.addMethod(
  1273. smalltalk.method({
  1274. selector: "collectionWithDuplicates",
  1275. protocol: 'fixture',
  1276. fn: function (){
  1277. var self=this;
  1278. return smalltalk.withContext(function($ctx1) {
  1279. self._subclassResponsibility();
  1280. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.CollectionTest)})},
  1281. args: [],
  1282. source: "collectionWithDuplicates\x0a\x09\x22Answers pre-filled collection of type tested,\x0a\x09with exactly five distinct elements,\x0a\x09some of them appearing multiple times.\x22\x0a\x0a\x09self subclassResponsibility",
  1283. messageSends: ["subclassResponsibility"],
  1284. referencedClasses: []
  1285. }),
  1286. smalltalk.CollectionTest);
  1287. smalltalk.addMethod(
  1288. smalltalk.method({
  1289. selector: "isCollectionReadOnly",
  1290. protocol: 'testing',
  1291. fn: function (){
  1292. var self=this;
  1293. return smalltalk.withContext(function($ctx1) {
  1294. return false;
  1295. }, function($ctx1) {$ctx1.fill(self,"isCollectionReadOnly",{},smalltalk.CollectionTest)})},
  1296. args: [],
  1297. source: "isCollectionReadOnly\x0a\x09^ false",
  1298. messageSends: [],
  1299. referencedClasses: []
  1300. }),
  1301. smalltalk.CollectionTest);
  1302. smalltalk.addMethod(
  1303. smalltalk.method({
  1304. selector: "sampleNewValue",
  1305. protocol: 'fixture',
  1306. fn: function (){
  1307. var self=this;
  1308. return smalltalk.withContext(function($ctx1) {
  1309. return "N";
  1310. }, function($ctx1) {$ctx1.fill(self,"sampleNewValue",{},smalltalk.CollectionTest)})},
  1311. args: [],
  1312. 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'",
  1313. messageSends: [],
  1314. referencedClasses: []
  1315. }),
  1316. smalltalk.CollectionTest);
  1317. smalltalk.addMethod(
  1318. smalltalk.method({
  1319. selector: "sampleNewValueAsCollection",
  1320. protocol: 'fixture',
  1321. fn: function (){
  1322. var self=this;
  1323. return smalltalk.withContext(function($ctx1) {
  1324. var $1;
  1325. $1=_st(self._collectionClass())._with_(self._sampleNewValue());
  1326. return $1;
  1327. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.CollectionTest)})},
  1328. args: [],
  1329. source: "sampleNewValueAsCollection\x0a\x09\x22Answers a value that is not yet there\x0a\x09and can be put into a tested collection,\x0a\x09wrapped in single element collection\x0a\x09of tested type\x22\x0a\x09\x0a\x09^ self collectionClass with: self sampleNewValue",
  1330. messageSends: ["with:", "collectionClass", "sampleNewValue"],
  1331. referencedClasses: []
  1332. }),
  1333. smalltalk.CollectionTest);
  1334. smalltalk.addMethod(
  1335. smalltalk.method({
  1336. selector: "sampleNonValue",
  1337. protocol: 'fixture',
  1338. fn: function (){
  1339. var self=this;
  1340. return smalltalk.withContext(function($ctx1) {
  1341. return (999);
  1342. }, function($ctx1) {$ctx1.fill(self,"sampleNonValue",{},smalltalk.CollectionTest)})},
  1343. args: [],
  1344. source: "sampleNonValue\x0a\x09\x22Answer value that is guaranteed\x0a\x09not to be contained by self collection\x22\x0a\x09\x0a\x09^ 999",
  1345. messageSends: [],
  1346. referencedClasses: []
  1347. }),
  1348. smalltalk.CollectionTest);
  1349. smalltalk.addMethod(
  1350. smalltalk.method({
  1351. selector: "testAddAll",
  1352. protocol: 'tests',
  1353. fn: function (){
  1354. var self=this;
  1355. return smalltalk.withContext(function($ctx1) {
  1356. var $2,$3,$5,$4,$6,$1,$7,$10,$9,$11,$12,$13,$8,$14,$17,$16,$18,$20,$19,$21,$15,$23,$24,$25,$26,$22,$27,$28,$29;
  1357. $2=self._collection();
  1358. $ctx1.sendIdx["collection"]=1;
  1359. $3=$2;
  1360. $5=self._collectionClass();
  1361. $ctx1.sendIdx["collectionClass"]=1;
  1362. $4=_st($5)._new();
  1363. $ctx1.sendIdx["new"]=1;
  1364. _st($3)._addAll_($4);
  1365. $ctx1.sendIdx["addAll:"]=1;
  1366. $6=_st($2)._yourself();
  1367. $ctx1.sendIdx["yourself"]=1;
  1368. $1=$6;
  1369. $7=self._collection();
  1370. $ctx1.sendIdx["collection"]=2;
  1371. self._assert_equals_($1,$7);
  1372. $ctx1.sendIdx["assert:equals:"]=1;
  1373. $10=self._collectionClass();
  1374. $ctx1.sendIdx["collectionClass"]=2;
  1375. $9=_st($10)._new();
  1376. $ctx1.sendIdx["new"]=2;
  1377. $11=$9;
  1378. $12=self._collection();
  1379. $ctx1.sendIdx["collection"]=3;
  1380. _st($11)._addAll_($12);
  1381. $ctx1.sendIdx["addAll:"]=2;
  1382. $13=_st($9)._yourself();
  1383. $ctx1.sendIdx["yourself"]=2;
  1384. $8=$13;
  1385. $14=self._collection();
  1386. $ctx1.sendIdx["collection"]=4;
  1387. self._assert_equals_($8,$14);
  1388. $ctx1.sendIdx["assert:equals:"]=2;
  1389. $17=self._collectionClass();
  1390. $ctx1.sendIdx["collectionClass"]=3;
  1391. $16=_st($17)._new();
  1392. $ctx1.sendIdx["new"]=3;
  1393. $18=$16;
  1394. $20=self._collectionClass();
  1395. $ctx1.sendIdx["collectionClass"]=4;
  1396. $19=_st($20)._new();
  1397. $ctx1.sendIdx["new"]=4;
  1398. _st($18)._addAll_($19);
  1399. $ctx1.sendIdx["addAll:"]=3;
  1400. $21=_st($16)._yourself();
  1401. $ctx1.sendIdx["yourself"]=3;
  1402. $15=$21;
  1403. self._assert_equals_($15,_st(self._collectionClass())._new());
  1404. $ctx1.sendIdx["assert:equals:"]=3;
  1405. $23=self._collection();
  1406. $ctx1.sendIdx["collection"]=5;
  1407. $24=$23;
  1408. $25=self._sampleNewValueAsCollection();
  1409. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1410. _st($24)._addAll_($25);
  1411. $ctx1.sendIdx["addAll:"]=4;
  1412. $26=_st($23)._yourself();
  1413. $ctx1.sendIdx["yourself"]=4;
  1414. $22=$26;
  1415. $27=self._collectionWithNewValue();
  1416. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1417. self._assert_equals_($22,$27);
  1418. $28=self._sampleNewValueAsCollection();
  1419. _st($28)._addAll_(self._collection());
  1420. $29=_st($28)._yourself();
  1421. self._assertSameContents_as_($29,self._collectionWithNewValue());
  1422. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.CollectionTest)})},
  1423. args: [],
  1424. source: "testAddAll\x0a\x09self assert: (self collection addAll: self collectionClass new; yourself) equals: self collection.\x0a\x09self assert: (self collectionClass new addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collectionClass new addAll: self collectionClass new; yourself) equals: self collectionClass new.\x0a\x09self assert: (self collection addAll: self sampleNewValueAsCollection; yourself) equals: self collectionWithNewValue.\x0a\x09self assertSameContents: (self sampleNewValueAsCollection addAll: self collection; yourself) as: self collectionWithNewValue",
  1425. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1426. referencedClasses: []
  1427. }),
  1428. smalltalk.CollectionTest);
  1429. smalltalk.addMethod(
  1430. smalltalk.method({
  1431. selector: "testAllSatisfy",
  1432. protocol: 'tests',
  1433. fn: function (){
  1434. var self=this;
  1435. var collection,anyOne;
  1436. return smalltalk.withContext(function($ctx1) {
  1437. var $1;
  1438. collection=self._collection();
  1439. anyOne=_st(collection)._anyOne();
  1440. $1=_st(collection)._allSatisfy_((function(each){
  1441. return smalltalk.withContext(function($ctx2) {
  1442. return _st(collection)._includes_(each);
  1443. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1444. $ctx1.sendIdx["allSatisfy:"]=1;
  1445. self._assert_($1);
  1446. self._deny_(_st(collection)._allSatisfy_((function(each){
  1447. return smalltalk.withContext(function($ctx2) {
  1448. return _st(each).__tild_eq(anyOne);
  1449. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1450. return self}, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},smalltalk.CollectionTest)})},
  1451. args: [],
  1452. source: "testAllSatisfy\x0a\x09| collection anyOne |\x0a\x09collection := self collection.\x0a\x09anyOne := collection anyOne.\x0a\x09self assert: (collection allSatisfy: [ :each | collection includes: each ]).\x0a\x09self deny: (collection allSatisfy: [ :each | each ~= anyOne ])",
  1453. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="],
  1454. referencedClasses: []
  1455. }),
  1456. smalltalk.CollectionTest);
  1457. smalltalk.addMethod(
  1458. smalltalk.method({
  1459. selector: "testAnyOne",
  1460. protocol: 'tests',
  1461. fn: function (){
  1462. var self=this;
  1463. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1464. return smalltalk.withContext(function($ctx1) {
  1465. var $2,$1;
  1466. self._should_raise_((function(){
  1467. return smalltalk.withContext(function($ctx2) {
  1468. return _st(_st(self._collectionClass())._new())._anyOne();
  1469. $ctx2.sendIdx["anyOne"]=1;
  1470. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  1471. $2=self._collection();
  1472. $ctx1.sendIdx["collection"]=1;
  1473. $1=_st($2)._includes_(_st(self._collection())._anyOne());
  1474. self._assert_($1);
  1475. return self}, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},smalltalk.CollectionTest)})},
  1476. args: [],
  1477. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  1478. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"],
  1479. referencedClasses: ["Error"]
  1480. }),
  1481. smalltalk.CollectionTest);
  1482. smalltalk.addMethod(
  1483. smalltalk.method({
  1484. selector: "testAnySatisfy",
  1485. protocol: 'tests',
  1486. fn: function (){
  1487. var self=this;
  1488. var anyOne;
  1489. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1490. return smalltalk.withContext(function($ctx1) {
  1491. var $1,$3,$2;
  1492. $1=self._collection();
  1493. $ctx1.sendIdx["collection"]=1;
  1494. anyOne=_st($1)._anyOne();
  1495. $3=self._collection();
  1496. $ctx1.sendIdx["collection"]=2;
  1497. $2=_st($3)._anySatisfy_((function(each){
  1498. return smalltalk.withContext(function($ctx2) {
  1499. return _st(each).__eq(anyOne);
  1500. $ctx2.sendIdx["="]=1;
  1501. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1502. $ctx1.sendIdx["anySatisfy:"]=1;
  1503. self._assert_($2);
  1504. self._deny_(_st(self._collection())._anySatisfy_((function(each){
  1505. return smalltalk.withContext(function($ctx2) {
  1506. return _st(each).__eq(_st($Object())._new());
  1507. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1508. return self}, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},smalltalk.CollectionTest)})},
  1509. args: [],
  1510. source: "testAnySatisfy\x0a\x09| anyOne |\x0a\x09anyOne := self collection anyOne.\x0a\x09self assert: (self collection anySatisfy: [ :each | each = anyOne ]).\x0a\x09self deny: (self collection anySatisfy: [ :each | each = Object new ])",
  1511. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"],
  1512. referencedClasses: ["Object"]
  1513. }),
  1514. smalltalk.CollectionTest);
  1515. smalltalk.addMethod(
  1516. smalltalk.method({
  1517. selector: "testAsArray",
  1518. protocol: 'tests',
  1519. fn: function (){
  1520. var self=this;
  1521. return smalltalk.withContext(function($ctx1) {
  1522. var $1;
  1523. $1=self._collection();
  1524. $ctx1.sendIdx["collection"]=1;
  1525. self._assertSameContents_as_($1,_st(self._collection())._asArray());
  1526. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.CollectionTest)})},
  1527. args: [],
  1528. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  1529. messageSends: ["assertSameContents:as:", "collection", "asArray"],
  1530. referencedClasses: []
  1531. }),
  1532. smalltalk.CollectionTest);
  1533. smalltalk.addMethod(
  1534. smalltalk.method({
  1535. selector: "testAsOrderedCollection",
  1536. protocol: 'tests',
  1537. fn: function (){
  1538. var self=this;
  1539. return smalltalk.withContext(function($ctx1) {
  1540. var $1;
  1541. $1=self._collection();
  1542. $ctx1.sendIdx["collection"]=1;
  1543. self._assertSameContents_as_($1,_st(self._collection())._asOrderedCollection());
  1544. return self}, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},smalltalk.CollectionTest)})},
  1545. args: [],
  1546. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  1547. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"],
  1548. referencedClasses: []
  1549. }),
  1550. smalltalk.CollectionTest);
  1551. smalltalk.addMethod(
  1552. smalltalk.method({
  1553. selector: "testAsSet",
  1554. protocol: 'tests',
  1555. fn: function (){
  1556. var self=this;
  1557. var c,set;
  1558. return smalltalk.withContext(function($ctx1) {
  1559. c=self._collectionWithDuplicates();
  1560. set=_st(c)._asSet();
  1561. self._assert_equals_(_st(set)._size(),(5));
  1562. _st(c)._do_((function(each){
  1563. return smalltalk.withContext(function($ctx2) {
  1564. return self._assert_(_st(set)._includes_(each));
  1565. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1566. return self}, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},smalltalk.CollectionTest)})},
  1567. args: [],
  1568. source: "testAsSet\x0a\x09| c set |\x0a\x09c := self collectionWithDuplicates.\x0a\x09set := c asSet.\x0a\x09self assert: set size equals: 5.\x0a\x09c do: [ :each |\x0a\x09\x09self assert: (set includes: each) ]",
  1569. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"],
  1570. referencedClasses: []
  1571. }),
  1572. smalltalk.CollectionTest);
  1573. smalltalk.addMethod(
  1574. smalltalk.method({
  1575. selector: "testCollect",
  1576. protocol: 'tests',
  1577. fn: function (){
  1578. var self=this;
  1579. var newCollection;
  1580. return smalltalk.withContext(function($ctx1) {
  1581. newCollection=[(1), (2), (3), (4)];
  1582. self._assertSameContents_as_(_st(self._collection())._collect_((function(each){
  1583. return smalltalk.withContext(function($ctx2) {
  1584. return _st(each)._abs();
  1585. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  1586. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1587. args: [],
  1588. source: "testCollect\x0a\x09| newCollection |\x0a\x09newCollection := #(1 2 3 4).\x0a\x09self\x0a\x09\x09assertSameContents: (self collection collect: [ :each |\x0a\x09\x09\x09each abs ])\x0a\x09\x09as: newCollection",
  1589. messageSends: ["assertSameContents:as:", "collect:", "collection", "abs"],
  1590. referencedClasses: []
  1591. }),
  1592. smalltalk.CollectionTest);
  1593. smalltalk.addMethod(
  1594. smalltalk.method({
  1595. selector: "testComma",
  1596. protocol: 'tests',
  1597. fn: function (){
  1598. var self=this;
  1599. return smalltalk.withContext(function($ctx1) {
  1600. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  1601. $2=self._collection();
  1602. $ctx1.sendIdx["collection"]=1;
  1603. $4=self._collectionClass();
  1604. $ctx1.sendIdx["collectionClass"]=1;
  1605. $3=_st($4)._new();
  1606. $ctx1.sendIdx["new"]=1;
  1607. $1=_st($2).__comma($3);
  1608. $ctx1.sendIdx[","]=1;
  1609. $5=self._collection();
  1610. $ctx1.sendIdx["collection"]=2;
  1611. self._assert_equals_($1,$5);
  1612. $ctx1.sendIdx["assert:equals:"]=1;
  1613. $8=self._collectionClass();
  1614. $ctx1.sendIdx["collectionClass"]=2;
  1615. $7=_st($8)._new();
  1616. $ctx1.sendIdx["new"]=2;
  1617. $9=self._collection();
  1618. $ctx1.sendIdx["collection"]=3;
  1619. $6=_st($7).__comma($9);
  1620. $ctx1.sendIdx[","]=2;
  1621. $10=self._collection();
  1622. $ctx1.sendIdx["collection"]=4;
  1623. self._assert_equals_($6,$10);
  1624. $ctx1.sendIdx["assert:equals:"]=2;
  1625. $13=self._collectionClass();
  1626. $ctx1.sendIdx["collectionClass"]=3;
  1627. $12=_st($13)._new();
  1628. $ctx1.sendIdx["new"]=3;
  1629. $15=self._collectionClass();
  1630. $ctx1.sendIdx["collectionClass"]=4;
  1631. $14=_st($15)._new();
  1632. $ctx1.sendIdx["new"]=4;
  1633. $11=_st($12).__comma($14);
  1634. $ctx1.sendIdx[","]=3;
  1635. self._assert_equals_($11,_st(self._collectionClass())._new());
  1636. $ctx1.sendIdx["assert:equals:"]=3;
  1637. $17=self._collection();
  1638. $ctx1.sendIdx["collection"]=5;
  1639. $18=self._sampleNewValueAsCollection();
  1640. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  1641. $16=_st($17).__comma($18);
  1642. $ctx1.sendIdx[","]=4;
  1643. $19=self._collectionWithNewValue();
  1644. $ctx1.sendIdx["collectionWithNewValue"]=1;
  1645. self._assert_equals_($16,$19);
  1646. self._assertSameContents_as_(_st(self._sampleNewValueAsCollection()).__comma(self._collection()),self._collectionWithNewValue());
  1647. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},smalltalk.CollectionTest)})},
  1648. args: [],
  1649. 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",
  1650. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"],
  1651. referencedClasses: []
  1652. }),
  1653. smalltalk.CollectionTest);
  1654. smalltalk.addMethod(
  1655. smalltalk.method({
  1656. selector: "testDetect",
  1657. protocol: 'tests',
  1658. fn: function (){
  1659. var self=this;
  1660. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  1661. return smalltalk.withContext(function($ctx1) {
  1662. var $2,$1;
  1663. $2=self._collection();
  1664. $ctx1.sendIdx["collection"]=1;
  1665. $1=_st($2)._detect_((function(each){
  1666. return smalltalk.withContext(function($ctx2) {
  1667. return _st(each).__lt((0));
  1668. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1669. $ctx1.sendIdx["detect:"]=1;
  1670. self._assert_equals_($1,(-4));
  1671. self._should_raise_((function(){
  1672. return smalltalk.withContext(function($ctx2) {
  1673. return _st(self._collection())._detect_((function(each){
  1674. return smalltalk.withContext(function($ctx3) {
  1675. return _st(each).__eq((6));
  1676. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)})}));
  1677. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  1678. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.CollectionTest)})},
  1679. args: [],
  1680. source: "testDetect\x0a\x09self assert: (self collection detect: [ :each | each < 0 ]) equals: -4.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ :each | each = 6 ] ]\x0a\x09\x09raise: Error",
  1681. messageSends: ["assert:equals:", "detect:", "collection", "<", "should:raise:", "="],
  1682. referencedClasses: ["Error"]
  1683. }),
  1684. smalltalk.CollectionTest);
  1685. smalltalk.addMethod(
  1686. smalltalk.method({
  1687. selector: "testDo",
  1688. protocol: 'tests',
  1689. fn: function (){
  1690. var self=this;
  1691. var newCollection;
  1692. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  1693. return smalltalk.withContext(function($ctx1) {
  1694. var $1,$2;
  1695. newCollection=_st($OrderedCollection())._new();
  1696. $ctx1.sendIdx["new"]=1;
  1697. $1=self._collection();
  1698. $ctx1.sendIdx["collection"]=1;
  1699. _st($1)._do_((function(each){
  1700. return smalltalk.withContext(function($ctx2) {
  1701. return _st(newCollection)._add_(each);
  1702. $ctx2.sendIdx["add:"]=1;
  1703. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1704. $ctx1.sendIdx["do:"]=1;
  1705. self._assertSameContents_as_(self._collection(),newCollection);
  1706. $ctx1.sendIdx["assertSameContents:as:"]=1;
  1707. newCollection=_st($OrderedCollection())._new();
  1708. $2=self._collectionWithDuplicates();
  1709. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  1710. _st($2)._do_((function(each){
  1711. return smalltalk.withContext(function($ctx2) {
  1712. return _st(newCollection)._add_(each);
  1713. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  1714. self._assertSameContents_as_(self._collectionWithDuplicates(),newCollection);
  1715. return self}, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1716. args: [],
  1717. 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",
  1718. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"],
  1719. referencedClasses: ["OrderedCollection"]
  1720. }),
  1721. smalltalk.CollectionTest);
  1722. smalltalk.addMethod(
  1723. smalltalk.method({
  1724. selector: "testIfEmptyFamily",
  1725. protocol: 'tests',
  1726. fn: function (){
  1727. var self=this;
  1728. return smalltalk.withContext(function($ctx1) {
  1729. var $3,$2,$1,$5,$4,$6,$9,$8,$7,$11,$10,$13,$12,$16,$15,$14,$18,$17,$19;
  1730. $3=self._collectionClass();
  1731. $ctx1.sendIdx["collectionClass"]=1;
  1732. $2=_st($3)._new();
  1733. $ctx1.sendIdx["new"]=1;
  1734. $1=_st($2)._ifEmpty_((function(){
  1735. return smalltalk.withContext(function($ctx2) {
  1736. return (42);
  1737. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1738. $ctx1.sendIdx["ifEmpty:"]=1;
  1739. self._assert_equals_($1,(42));
  1740. $ctx1.sendIdx["assert:equals:"]=1;
  1741. $5=self._collection();
  1742. $ctx1.sendIdx["collection"]=1;
  1743. $4=_st($5)._ifEmpty_((function(){
  1744. return smalltalk.withContext(function($ctx2) {
  1745. return (42);
  1746. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  1747. $6=self._collection();
  1748. $ctx1.sendIdx["collection"]=2;
  1749. self._assert_equals_($4,$6);
  1750. $ctx1.sendIdx["assert:equals:"]=2;
  1751. $9=self._collectionClass();
  1752. $ctx1.sendIdx["collectionClass"]=2;
  1753. $8=_st($9)._new();
  1754. $ctx1.sendIdx["new"]=2;
  1755. $7=_st($8)._ifNotEmpty_((function(){
  1756. return smalltalk.withContext(function($ctx2) {
  1757. return (42);
  1758. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  1759. $ctx1.sendIdx["ifNotEmpty:"]=1;
  1760. $11=self._collectionClass();
  1761. $ctx1.sendIdx["collectionClass"]=3;
  1762. $10=_st($11)._new();
  1763. $ctx1.sendIdx["new"]=3;
  1764. self._assert_equals_($7,$10);
  1765. $ctx1.sendIdx["assert:equals:"]=3;
  1766. $13=self._collection();
  1767. $ctx1.sendIdx["collection"]=3;
  1768. $12=_st($13)._ifNotEmpty_((function(){
  1769. return smalltalk.withContext(function($ctx2) {
  1770. return (42);
  1771. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  1772. self._assert_equals_($12,(42));
  1773. $ctx1.sendIdx["assert:equals:"]=4;
  1774. $16=self._collectionClass();
  1775. $ctx1.sendIdx["collectionClass"]=4;
  1776. $15=_st($16)._new();
  1777. $ctx1.sendIdx["new"]=4;
  1778. $14=_st($15)._ifEmpty_ifNotEmpty_((function(){
  1779. return smalltalk.withContext(function($ctx2) {
  1780. return (42);
  1781. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),(function(){
  1782. return smalltalk.withContext(function($ctx2) {
  1783. return (999);
  1784. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  1785. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  1786. self._assert_equals_($14,(42));
  1787. $ctx1.sendIdx["assert:equals:"]=5;
  1788. $18=self._collection();
  1789. $ctx1.sendIdx["collection"]=4;
  1790. $17=_st($18)._ifEmpty_ifNotEmpty_((function(){
  1791. return smalltalk.withContext(function($ctx2) {
  1792. return (42);
  1793. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),(function(){
  1794. return smalltalk.withContext(function($ctx2) {
  1795. return (999);
  1796. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}));
  1797. self._assert_equals_($17,(999));
  1798. $ctx1.sendIdx["assert:equals:"]=6;
  1799. $19=_st(_st(self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  1800. return smalltalk.withContext(function($ctx2) {
  1801. return (42);
  1802. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),(function(){
  1803. return smalltalk.withContext(function($ctx2) {
  1804. return (999);
  1805. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}));
  1806. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  1807. self._assert_equals_($19,(999));
  1808. $ctx1.sendIdx["assert:equals:"]=7;
  1809. self._assert_equals_(_st(self._collection())._ifNotEmpty_ifEmpty_((function(){
  1810. return smalltalk.withContext(function($ctx2) {
  1811. return (42);
  1812. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),(function(){
  1813. return smalltalk.withContext(function($ctx2) {
  1814. return (999);
  1815. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})})),(42));
  1816. return self}, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},smalltalk.CollectionTest)})},
  1817. args: [],
  1818. 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",
  1819. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"],
  1820. referencedClasses: []
  1821. }),
  1822. smalltalk.CollectionTest);
  1823. smalltalk.addMethod(
  1824. smalltalk.method({
  1825. selector: "testIsEmpty",
  1826. protocol: 'tests',
  1827. fn: function (){
  1828. var self=this;
  1829. return smalltalk.withContext(function($ctx1) {
  1830. var $1;
  1831. $1=_st(_st(self._collectionClass())._new())._isEmpty();
  1832. $ctx1.sendIdx["isEmpty"]=1;
  1833. self._assert_($1);
  1834. self._deny_(_st(self._collection())._isEmpty());
  1835. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},smalltalk.CollectionTest)})},
  1836. args: [],
  1837. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  1838. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"],
  1839. referencedClasses: []
  1840. }),
  1841. smalltalk.CollectionTest);
  1842. smalltalk.addMethod(
  1843. smalltalk.method({
  1844. selector: "testNoneSatisfy",
  1845. protocol: 'tests',
  1846. fn: function (){
  1847. var self=this;
  1848. var anyOne;
  1849. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  1850. return smalltalk.withContext(function($ctx1) {
  1851. var $1,$3,$2;
  1852. $1=self._collection();
  1853. $ctx1.sendIdx["collection"]=1;
  1854. anyOne=_st($1)._anyOne();
  1855. $3=self._collection();
  1856. $ctx1.sendIdx["collection"]=2;
  1857. $2=_st($3)._noneSatisfy_((function(each){
  1858. return smalltalk.withContext(function($ctx2) {
  1859. return _st(each).__eq(anyOne);
  1860. $ctx2.sendIdx["="]=1;
  1861. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  1862. $ctx1.sendIdx["noneSatisfy:"]=1;
  1863. self._deny_($2);
  1864. self._assert_(_st(self._collection())._noneSatisfy_((function(each){
  1865. return smalltalk.withContext(function($ctx2) {
  1866. return _st(each).__eq(_st($Object())._new());
  1867. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})})));
  1868. return self}, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},smalltalk.CollectionTest)})},
  1869. args: [],
  1870. 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 ])",
  1871. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"],
  1872. referencedClasses: ["Object"]
  1873. }),
  1874. smalltalk.CollectionTest);
  1875. smalltalk.addMethod(
  1876. smalltalk.method({
  1877. selector: "testRemoveAll",
  1878. protocol: 'tests',
  1879. fn: function (){
  1880. var self=this;
  1881. return smalltalk.withContext(function($ctx1) {
  1882. var $1,$2;
  1883. $1=self._collection();
  1884. _st($1)._removeAll();
  1885. $2=_st($1)._yourself();
  1886. self._assert_equals_($2,_st(self._collectionClass())._new());
  1887. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},smalltalk.CollectionTest)})},
  1888. args: [],
  1889. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  1890. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"],
  1891. referencedClasses: []
  1892. }),
  1893. smalltalk.CollectionTest);
  1894. smalltalk.addMethod(
  1895. smalltalk.method({
  1896. selector: "testSelect",
  1897. protocol: 'tests',
  1898. fn: function (){
  1899. var self=this;
  1900. var newCollection;
  1901. return smalltalk.withContext(function($ctx1) {
  1902. newCollection=[(2), (-4)];
  1903. self._assertSameContents_as_(_st(self._collection())._select_((function(each){
  1904. return smalltalk.withContext(function($ctx2) {
  1905. return _st(each)._even();
  1906. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  1907. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection},smalltalk.CollectionTest)})},
  1908. args: [],
  1909. source: "testSelect\x0a\x09| newCollection |\x0a\x09newCollection := #(2 -4).\x0a\x09self\x0a\x09\x09assertSameContents: (self collection select: [ :each |\x0a\x09\x09\x09each even ])\x0a\x09\x09as: newCollection",
  1910. messageSends: ["assertSameContents:as:", "select:", "collection", "even"],
  1911. referencedClasses: []
  1912. }),
  1913. smalltalk.CollectionTest);
  1914. smalltalk.addMethod(
  1915. smalltalk.method({
  1916. selector: "testSize",
  1917. protocol: 'tests',
  1918. fn: function (){
  1919. var self=this;
  1920. return smalltalk.withContext(function($ctx1) {
  1921. var $1,$2;
  1922. $1=_st(_st(self._collectionClass())._new())._size();
  1923. $ctx1.sendIdx["size"]=1;
  1924. self._assert_equals_($1,(0));
  1925. $ctx1.sendIdx["assert:equals:"]=1;
  1926. $2=_st(self._sampleNewValueAsCollection())._size();
  1927. $ctx1.sendIdx["size"]=2;
  1928. self._assert_equals_($2,(1));
  1929. $ctx1.sendIdx["assert:equals:"]=2;
  1930. self._assert_equals_(_st(self._collection())._size(),self._collectionSize());
  1931. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.CollectionTest)})},
  1932. args: [],
  1933. 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",
  1934. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"],
  1935. referencedClasses: []
  1936. }),
  1937. smalltalk.CollectionTest);
  1938. smalltalk.addMethod(
  1939. smalltalk.method({
  1940. selector: "collectionClass",
  1941. protocol: 'fixture',
  1942. fn: function (){
  1943. var self=this;
  1944. return smalltalk.withContext(function($ctx1) {
  1945. return nil;
  1946. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.CollectionTest.klass)})},
  1947. args: [],
  1948. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  1949. messageSends: [],
  1950. referencedClasses: []
  1951. }),
  1952. smalltalk.CollectionTest.klass);
  1953. smalltalk.addMethod(
  1954. smalltalk.method({
  1955. selector: "isAbstract",
  1956. protocol: 'testing',
  1957. fn: function (){
  1958. var self=this;
  1959. return smalltalk.withContext(function($ctx1) {
  1960. var $1;
  1961. $1=_st(self._collectionClass())._isNil();
  1962. return $1;
  1963. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.CollectionTest.klass)})},
  1964. args: [],
  1965. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  1966. messageSends: ["isNil", "collectionClass"],
  1967. referencedClasses: []
  1968. }),
  1969. smalltalk.CollectionTest.klass);
  1970. smalltalk.addClass('IndexableCollectionTest', smalltalk.CollectionTest, [], 'Kernel-Tests');
  1971. smalltalk.addMethod(
  1972. smalltalk.method({
  1973. selector: "collectionWithNewValue",
  1974. protocol: 'fixture',
  1975. fn: function (){
  1976. var self=this;
  1977. return smalltalk.withContext(function($ctx1) {
  1978. self._subclassResponsibility();
  1979. return self}, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.IndexableCollectionTest)})},
  1980. args: [],
  1981. 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",
  1982. messageSends: ["subclassResponsibility"],
  1983. referencedClasses: []
  1984. }),
  1985. smalltalk.IndexableCollectionTest);
  1986. smalltalk.addMethod(
  1987. smalltalk.method({
  1988. selector: "sampleNewIndex",
  1989. protocol: 'fixture',
  1990. fn: function (){
  1991. var self=this;
  1992. return smalltalk.withContext(function($ctx1) {
  1993. self._subclassResponsibility();
  1994. return self}, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.IndexableCollectionTest)})},
  1995. args: [],
  1996. 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",
  1997. messageSends: ["subclassResponsibility"],
  1998. referencedClasses: []
  1999. }),
  2000. smalltalk.IndexableCollectionTest);
  2001. smalltalk.addMethod(
  2002. smalltalk.method({
  2003. selector: "sampleNonIndexesDo:",
  2004. protocol: 'fixture',
  2005. fn: function (aBlock){
  2006. var self=this;
  2007. return smalltalk.withContext(function($ctx1) {
  2008. self._subclassResponsibility();
  2009. return self}, function($ctx1) {$ctx1.fill(self,"sampleNonIndexesDo:",{aBlock:aBlock},smalltalk.IndexableCollectionTest)})},
  2010. args: ["aBlock"],
  2011. 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",
  2012. messageSends: ["subclassResponsibility"],
  2013. referencedClasses: []
  2014. }),
  2015. smalltalk.IndexableCollectionTest);
  2016. smalltalk.addMethod(
  2017. smalltalk.method({
  2018. selector: "samplesDo:",
  2019. protocol: 'fixture',
  2020. fn: function (aBlock){
  2021. var self=this;
  2022. return smalltalk.withContext(function($ctx1) {
  2023. self._subclassResponsibility();
  2024. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.IndexableCollectionTest)})},
  2025. args: ["aBlock"],
  2026. 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",
  2027. messageSends: ["subclassResponsibility"],
  2028. referencedClasses: []
  2029. }),
  2030. smalltalk.IndexableCollectionTest);
  2031. smalltalk.addMethod(
  2032. smalltalk.method({
  2033. selector: "testAt",
  2034. protocol: 'tests',
  2035. fn: function (){
  2036. var self=this;
  2037. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2038. return smalltalk.withContext(function($ctx1) {
  2039. var $1;
  2040. self._nonIndexesDo_((function(each){
  2041. return smalltalk.withContext(function($ctx2) {
  2042. return self._should_raise_((function(){
  2043. return smalltalk.withContext(function($ctx3) {
  2044. $1=self._collection();
  2045. $ctx3.sendIdx["collection"]=1;
  2046. return _st($1)._at_(each);
  2047. $ctx3.sendIdx["at:"]=1;
  2048. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}),$Error());
  2049. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2050. self._samplesDo_((function(index,value){
  2051. return smalltalk.withContext(function($ctx2) {
  2052. return self._assert_equals_(_st(self._collection())._at_(index),value);
  2053. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2054. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.IndexableCollectionTest)})},
  2055. args: [],
  2056. 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 ]",
  2057. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"],
  2058. referencedClasses: ["Error"]
  2059. }),
  2060. smalltalk.IndexableCollectionTest);
  2061. smalltalk.addMethod(
  2062. smalltalk.method({
  2063. selector: "testAtIfAbsent",
  2064. protocol: 'tests',
  2065. fn: function (){
  2066. var self=this;
  2067. return smalltalk.withContext(function($ctx1) {
  2068. var $2,$1,$3;
  2069. self._nonIndexesDo_((function(each){
  2070. return smalltalk.withContext(function($ctx2) {
  2071. $2=self._collection();
  2072. $ctx2.sendIdx["collection"]=1;
  2073. $1=_st($2)._at_ifAbsent_(each,(function(){
  2074. return smalltalk.withContext(function($ctx3) {
  2075. return self._sampleNonValue();
  2076. $ctx3.sendIdx["sampleNonValue"]=1;
  2077. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
  2078. $ctx2.sendIdx["at:ifAbsent:"]=1;
  2079. $3=self._sampleNonValue();
  2080. $ctx2.sendIdx["sampleNonValue"]=2;
  2081. return self._assert_equals_($1,$3);
  2082. $ctx2.sendIdx["assert:equals:"]=1;
  2083. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2084. self._samplesDo_((function(index,value){
  2085. return smalltalk.withContext(function($ctx2) {
  2086. return self._assert_equals_(_st(self._collection())._at_ifAbsent_(index,(function(){
  2087. return smalltalk.withContext(function($ctx3) {
  2088. return self._sampleNonValue();
  2089. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)})})),value);
  2090. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2091. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},smalltalk.IndexableCollectionTest)})},
  2092. args: [],
  2093. source: "testAtIfAbsent\x0a\x09self nonIndexesDo: [ :each |\x0a\x09\x09self assert: (self collection at: each ifAbsent: [ self sampleNonValue ]) equals: self sampleNonValue ].\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection at: index ifAbsent: [ self sampleNonValue ]) equals: value ].",
  2094. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNonValue", "samplesDo:"],
  2095. referencedClasses: []
  2096. }),
  2097. smalltalk.IndexableCollectionTest);
  2098. smalltalk.addMethod(
  2099. smalltalk.method({
  2100. selector: "testAtIfPresent",
  2101. protocol: 'tests',
  2102. fn: function (){
  2103. var self=this;
  2104. var visited,sentinel;
  2105. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2106. return smalltalk.withContext(function($ctx1) {
  2107. var $2,$1,$4,$3;
  2108. sentinel=_st($Object())._new();
  2109. self._nonIndexesDo_((function(each){
  2110. return smalltalk.withContext(function($ctx2) {
  2111. visited=nil;
  2112. visited;
  2113. $2=self._collection();
  2114. $ctx2.sendIdx["collection"]=1;
  2115. $1=_st($2)._at_ifPresent_(each,(function(value1){
  2116. return smalltalk.withContext(function($ctx3) {
  2117. visited=value1;
  2118. visited;
  2119. return sentinel;
  2120. }, function($ctx3) {$ctx3.fillBlock({value1:value1},$ctx2,2)})}));
  2121. $ctx2.sendIdx["at:ifPresent:"]=1;
  2122. self._assert_equals_($1,nil);
  2123. $ctx2.sendIdx["assert:equals:"]=1;
  2124. return self._assert_(_st(visited)._isNil());
  2125. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2126. self._samplesDo_((function(index,value){
  2127. return smalltalk.withContext(function($ctx2) {
  2128. visited=nil;
  2129. visited;
  2130. $4=self._collection();
  2131. $ctx2.sendIdx["collection"]=2;
  2132. $3=_st($4)._at_ifPresent_(index,(function(value2){
  2133. return smalltalk.withContext(function($ctx3) {
  2134. visited=value2;
  2135. visited;
  2136. return sentinel;
  2137. }, function($ctx3) {$ctx3.fillBlock({value2:value2},$ctx2,4)})}));
  2138. self._assert_equals_($3,sentinel);
  2139. $ctx2.sendIdx["assert:equals:"]=2;
  2140. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2141. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)})}));
  2142. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},smalltalk.IndexableCollectionTest)})},
  2143. args: [],
  2144. 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) ]",
  2145. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"],
  2146. referencedClasses: ["Object"]
  2147. }),
  2148. smalltalk.IndexableCollectionTest);
  2149. smalltalk.addMethod(
  2150. smalltalk.method({
  2151. selector: "testAtIfPresentIfAbsent",
  2152. protocol: 'tests',
  2153. fn: function (){
  2154. var self=this;
  2155. var visited,sentinel;
  2156. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  2157. return smalltalk.withContext(function($ctx1) {
  2158. var $2,$1,$3,$5,$4;
  2159. sentinel=_st($Object())._new();
  2160. self._nonIndexesDo_((function(each){
  2161. return smalltalk.withContext(function($ctx2) {
  2162. visited=nil;
  2163. visited;
  2164. $2=self._collection();
  2165. $ctx2.sendIdx["collection"]=1;
  2166. $1=_st($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  2167. return smalltalk.withContext(function($ctx3) {
  2168. visited=value1;
  2169. visited;
  2170. return sentinel;
  2171. }, function($ctx3) {$ctx3.fillBlock({value1:value1},$ctx2,2)})}),(function(){
  2172. return smalltalk.withContext(function($ctx3) {
  2173. return self._sampleNonValue();
  2174. $ctx3.sendIdx["sampleNonValue"]=1;
  2175. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}));
  2176. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  2177. $3=self._sampleNonValue();
  2178. $ctx2.sendIdx["sampleNonValue"]=2;
  2179. self._assert_equals_($1,$3);
  2180. $ctx2.sendIdx["assert:equals:"]=1;
  2181. return self._assert_(_st(visited)._isNil());
  2182. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2183. self._samplesDo_((function(index,value){
  2184. return smalltalk.withContext(function($ctx2) {
  2185. visited=nil;
  2186. visited;
  2187. $5=self._collection();
  2188. $ctx2.sendIdx["collection"]=2;
  2189. $4=_st($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  2190. return smalltalk.withContext(function($ctx3) {
  2191. visited=value2;
  2192. visited;
  2193. return sentinel;
  2194. }, function($ctx3) {$ctx3.fillBlock({value2:value2},$ctx2,5)})}),(function(){
  2195. return smalltalk.withContext(function($ctx3) {
  2196. return self._sampleNonValue();
  2197. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)})}));
  2198. self._assert_equals_($4,sentinel);
  2199. $ctx2.sendIdx["assert:equals:"]=2;
  2200. return self._assert_equals_(visited,_st(self._collection())._at_(index));
  2201. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)})}));
  2202. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},smalltalk.IndexableCollectionTest)})},
  2203. args: [],
  2204. 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 sampleNonValue ] ) equals: self sampleNonValue.\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 sampleNonValue ]) equals: sentinel.\x0a\x09\x09self assert: visited equals: (self collection at: index) ]",
  2205. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNonValue", "assert:", "isNil", "samplesDo:", "at:"],
  2206. referencedClasses: ["Object"]
  2207. }),
  2208. smalltalk.IndexableCollectionTest);
  2209. smalltalk.addMethod(
  2210. smalltalk.method({
  2211. selector: "testAtPut",
  2212. protocol: 'tests',
  2213. fn: function (){
  2214. var self=this;
  2215. var newCollection;
  2216. return smalltalk.withContext(function($ctx1) {
  2217. newCollection=self._collection();
  2218. $ctx1.sendIdx["collection"]=1;
  2219. self._samplesDo_((function(index,value){
  2220. return smalltalk.withContext(function($ctx2) {
  2221. return _st(newCollection)._at_put_(index,value);
  2222. $ctx2.sendIdx["at:put:"]=1;
  2223. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
  2224. self._assert_equals_(newCollection,self._collection());
  2225. $ctx1.sendIdx["assert:equals:"]=1;
  2226. _st(newCollection)._at_put_(self._sampleNewIndex(),self._sampleNewValue());
  2227. self._assert_equals_(newCollection,self._collectionWithNewValue());
  2228. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},smalltalk.IndexableCollectionTest)})},
  2229. args: [],
  2230. 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",
  2231. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"],
  2232. referencedClasses: []
  2233. }),
  2234. smalltalk.IndexableCollectionTest);
  2235. smalltalk.addMethod(
  2236. smalltalk.method({
  2237. selector: "testIndexOf",
  2238. protocol: 'tests',
  2239. fn: function (){
  2240. var self=this;
  2241. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2242. return smalltalk.withContext(function($ctx1) {
  2243. var $1;
  2244. self._should_raise_((function(){
  2245. return smalltalk.withContext(function($ctx2) {
  2246. $1=self._collection();
  2247. $ctx2.sendIdx["collection"]=1;
  2248. return _st($1)._indexOf_(self._sampleNonValue());
  2249. $ctx2.sendIdx["indexOf:"]=1;
  2250. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2251. self._samplesDo_((function(index,value){
  2252. return smalltalk.withContext(function($ctx2) {
  2253. return self._assert_equals_(_st(self._collection())._indexOf_(value),index);
  2254. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)})}));
  2255. return self}, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},smalltalk.IndexableCollectionTest)})},
  2256. args: [],
  2257. source: "testIndexOf\x0a\x09self should: [ self collection indexOf: self sampleNonValue ] raise: Error.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (self collection indexOf: value) equals: index ]",
  2258. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNonValue", "samplesDo:", "assert:equals:"],
  2259. referencedClasses: ["Error"]
  2260. }),
  2261. smalltalk.IndexableCollectionTest);
  2262. smalltalk.addMethod(
  2263. smalltalk.method({
  2264. selector: "testWithIndexDo",
  2265. protocol: 'tests',
  2266. fn: function (){
  2267. var self=this;
  2268. var collection;
  2269. return smalltalk.withContext(function($ctx1) {
  2270. collection=self._collection();
  2271. $ctx1.sendIdx["collection"]=1;
  2272. _st(self._collection())._withIndexDo_((function(each,index){
  2273. return smalltalk.withContext(function($ctx2) {
  2274. return self._assert_equals_(_st(collection)._at_(index),each);
  2275. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)})}));
  2276. return self}, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},smalltalk.IndexableCollectionTest)})},
  2277. args: [],
  2278. 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 ]",
  2279. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"],
  2280. referencedClasses: []
  2281. }),
  2282. smalltalk.IndexableCollectionTest);
  2283. smalltalk.addClass('HashedCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  2284. smalltalk.addMethod(
  2285. smalltalk.method({
  2286. selector: "collection",
  2287. protocol: 'fixture',
  2288. fn: function (){
  2289. var self=this;
  2290. return smalltalk.withContext(function($ctx1) {
  2291. var $2,$3,$4,$1;
  2292. $2="b".__minus_gt((1));
  2293. $ctx1.sendIdx["->"]=1;
  2294. $3="a".__minus_gt((2));
  2295. $ctx1.sendIdx["->"]=2;
  2296. $4="c".__minus_gt((3));
  2297. $ctx1.sendIdx["->"]=3;
  2298. $1=smalltalk.HashedCollection._from_([$2,$3,$4,"d".__minus_gt((-4))]);
  2299. return $1;
  2300. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.HashedCollectionTest)})},
  2301. args: [],
  2302. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  2303. messageSends: ["->"],
  2304. referencedClasses: []
  2305. }),
  2306. smalltalk.HashedCollectionTest);
  2307. smalltalk.addMethod(
  2308. smalltalk.method({
  2309. selector: "collectionSize",
  2310. protocol: 'fixture',
  2311. fn: function (){
  2312. var self=this;
  2313. return smalltalk.withContext(function($ctx1) {
  2314. return (4);
  2315. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.HashedCollectionTest)})},
  2316. args: [],
  2317. source: "collectionSize\x0a\x09^ 4",
  2318. messageSends: [],
  2319. referencedClasses: []
  2320. }),
  2321. smalltalk.HashedCollectionTest);
  2322. smalltalk.addMethod(
  2323. smalltalk.method({
  2324. selector: "collectionWithDuplicates",
  2325. protocol: 'fixture',
  2326. fn: function (){
  2327. var self=this;
  2328. return smalltalk.withContext(function($ctx1) {
  2329. var $2,$3,$4,$5,$6,$7,$1;
  2330. $2="b".__minus_gt((1));
  2331. $ctx1.sendIdx["->"]=1;
  2332. $3="a".__minus_gt((2));
  2333. $ctx1.sendIdx["->"]=2;
  2334. $4="c".__minus_gt((3));
  2335. $ctx1.sendIdx["->"]=3;
  2336. $5="d".__minus_gt((-4));
  2337. $ctx1.sendIdx["->"]=4;
  2338. $6="e".__minus_gt((1));
  2339. $ctx1.sendIdx["->"]=5;
  2340. $7="f".__minus_gt((2));
  2341. $ctx1.sendIdx["->"]=6;
  2342. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5,$6,$7,"g".__minus_gt((10))]);
  2343. return $1;
  2344. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.HashedCollectionTest)})},
  2345. args: [],
  2346. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10 }",
  2347. messageSends: ["->"],
  2348. referencedClasses: []
  2349. }),
  2350. smalltalk.HashedCollectionTest);
  2351. smalltalk.addMethod(
  2352. smalltalk.method({
  2353. selector: "collectionWithNewValue",
  2354. protocol: 'fixture',
  2355. fn: function (){
  2356. var self=this;
  2357. return smalltalk.withContext(function($ctx1) {
  2358. var $2,$3,$4,$5,$1;
  2359. $2="b".__minus_gt((1));
  2360. $ctx1.sendIdx["->"]=1;
  2361. $3="a".__minus_gt((2));
  2362. $ctx1.sendIdx["->"]=2;
  2363. $4="c".__minus_gt((3));
  2364. $ctx1.sendIdx["->"]=3;
  2365. $5="d".__minus_gt((-4));
  2366. $ctx1.sendIdx["->"]=4;
  2367. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5,"new".__minus_gt("N")]);
  2368. return $1;
  2369. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.HashedCollectionTest)})},
  2370. args: [],
  2371. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  2372. messageSends: ["->"],
  2373. referencedClasses: []
  2374. }),
  2375. smalltalk.HashedCollectionTest);
  2376. smalltalk.addMethod(
  2377. smalltalk.method({
  2378. selector: "nonIndexesDo:",
  2379. protocol: 'fixture',
  2380. fn: function (aBlock){
  2381. var self=this;
  2382. return smalltalk.withContext(function($ctx1) {
  2383. _st(aBlock)._value_((5));
  2384. $ctx1.sendIdx["value:"]=1;
  2385. _st(aBlock)._value_("z");
  2386. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},smalltalk.HashedCollectionTest)})},
  2387. args: ["aBlock"],
  2388. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: 'z'",
  2389. messageSends: ["value:"],
  2390. referencedClasses: []
  2391. }),
  2392. smalltalk.HashedCollectionTest);
  2393. smalltalk.addMethod(
  2394. smalltalk.method({
  2395. selector: "sampleNewIndex",
  2396. protocol: 'fixture',
  2397. fn: function (){
  2398. var self=this;
  2399. return smalltalk.withContext(function($ctx1) {
  2400. return "new";
  2401. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.HashedCollectionTest)})},
  2402. args: [],
  2403. source: "sampleNewIndex\x0a\x09^ 'new'",
  2404. messageSends: [],
  2405. referencedClasses: []
  2406. }),
  2407. smalltalk.HashedCollectionTest);
  2408. smalltalk.addMethod(
  2409. smalltalk.method({
  2410. selector: "sampleNewValueAsCollection",
  2411. protocol: 'fixture',
  2412. fn: function (){
  2413. var self=this;
  2414. return smalltalk.withContext(function($ctx1) {
  2415. var $1;
  2416. $1=smalltalk.HashedCollection._from_(["new".__minus_gt("N")]);
  2417. return $1;
  2418. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.HashedCollectionTest)})},
  2419. args: [],
  2420. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  2421. messageSends: ["->"],
  2422. referencedClasses: []
  2423. }),
  2424. smalltalk.HashedCollectionTest);
  2425. smalltalk.addMethod(
  2426. smalltalk.method({
  2427. selector: "samplesDo:",
  2428. protocol: 'fixture',
  2429. fn: function (aBlock){
  2430. var self=this;
  2431. return smalltalk.withContext(function($ctx1) {
  2432. _st(aBlock)._value_value_("a",(2));
  2433. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.HashedCollectionTest)})},
  2434. args: ["aBlock"],
  2435. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  2436. messageSends: ["value:value:"],
  2437. referencedClasses: []
  2438. }),
  2439. smalltalk.HashedCollectionTest);
  2440. smalltalk.addMethod(
  2441. smalltalk.method({
  2442. selector: "testAddAll",
  2443. protocol: 'tests',
  2444. fn: function (){
  2445. var self=this;
  2446. return smalltalk.withContext(function($ctx1) {
  2447. var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
  2448. smalltalk.HashedCollectionTest.superclass.fn.prototype._testAddAll.apply(_st(self), []);
  2449. $2=self._collection();
  2450. $ctx1.sendIdx["collection"]=1;
  2451. $3=$2;
  2452. $4=self._collection();
  2453. $ctx1.sendIdx["collection"]=2;
  2454. _st($3)._addAll_($4);
  2455. $ctx1.sendIdx["addAll:"]=1;
  2456. $5=_st($2)._yourself();
  2457. $ctx1.sendIdx["yourself"]=1;
  2458. $1=$5;
  2459. $6=self._collection();
  2460. $ctx1.sendIdx["collection"]=3;
  2461. self._assert_equals_($1,$6);
  2462. $ctx1.sendIdx["assert:equals:"]=1;
  2463. $8=self._collection();
  2464. $ctx1.sendIdx["collection"]=4;
  2465. $9=$8;
  2466. $10=self._collectionWithNewValue();
  2467. $ctx1.sendIdx["collectionWithNewValue"]=1;
  2468. _st($9)._addAll_($10);
  2469. $ctx1.sendIdx["addAll:"]=2;
  2470. $11=_st($8)._yourself();
  2471. $ctx1.sendIdx["yourself"]=2;
  2472. $7=$11;
  2473. $12=self._collectionWithNewValue();
  2474. $ctx1.sendIdx["collectionWithNewValue"]=2;
  2475. self._assert_equals_($7,$12);
  2476. $ctx1.sendIdx["assert:equals:"]=2;
  2477. $14=self._collectionWithNewValue();
  2478. $ctx1.sendIdx["collectionWithNewValue"]=3;
  2479. _st($14)._addAll_(self._collection());
  2480. $15=_st($14)._yourself();
  2481. $13=$15;
  2482. self._assert_equals_($13,self._collectionWithNewValue());
  2483. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.HashedCollectionTest)})},
  2484. args: [],
  2485. 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",
  2486. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
  2487. referencedClasses: []
  2488. }),
  2489. smalltalk.HashedCollectionTest);
  2490. smalltalk.addMethod(
  2491. smalltalk.method({
  2492. selector: "testAsDictionary",
  2493. protocol: 'tests',
  2494. fn: function (){
  2495. var self=this;
  2496. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2497. return smalltalk.withContext(function($ctx1) {
  2498. self._assert_(_st(_st(_st(self._collectionClass())._new())._asDictionary())._isMemberOf_($Dictionary()));
  2499. return self}, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},smalltalk.HashedCollectionTest)})},
  2500. args: [],
  2501. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  2502. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"],
  2503. referencedClasses: ["Dictionary"]
  2504. }),
  2505. smalltalk.HashedCollectionTest);
  2506. smalltalk.addMethod(
  2507. smalltalk.method({
  2508. selector: "testComma",
  2509. protocol: 'tests',
  2510. fn: function (){
  2511. var self=this;
  2512. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2513. return smalltalk.withContext(function($ctx1) {
  2514. var $1;
  2515. self._should_raise_((function(){
  2516. return smalltalk.withContext(function($ctx2) {
  2517. $1=self._collection();
  2518. $ctx2.sendIdx["collection"]=1;
  2519. return _st($1).__comma(self._collection());
  2520. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  2521. return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},smalltalk.HashedCollectionTest)})},
  2522. args: [],
  2523. source: "testComma\x0a\x09self should: [ self collection, self collection ] raise: Error",
  2524. messageSends: ["should:raise:", ",", "collection"],
  2525. referencedClasses: ["Error"]
  2526. }),
  2527. smalltalk.HashedCollectionTest);
  2528. smalltalk.addMethod(
  2529. smalltalk.method({
  2530. selector: "testFrom",
  2531. protocol: 'tests',
  2532. fn: function (){
  2533. var self=this;
  2534. var associations;
  2535. return smalltalk.withContext(function($ctx1) {
  2536. var $1,$2,$3,$5,$4;
  2537. $1="a".__minus_gt((1));
  2538. $ctx1.sendIdx["->"]=1;
  2539. $2="b".__minus_gt((2));
  2540. $ctx1.sendIdx["->"]=2;
  2541. associations=[$1,$2];
  2542. $3=_st(_st(self._class())._collectionClass())._from_(associations);
  2543. $5="a".__minus_gt((1));
  2544. $ctx1.sendIdx["->"]=3;
  2545. $4=smalltalk.HashedCollection._from_([$5,"b".__minus_gt((2))]);
  2546. self._assertSameContents_as_($3,$4);
  2547. return self}, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},smalltalk.HashedCollectionTest)})},
  2548. args: [],
  2549. 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 }.",
  2550. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"],
  2551. referencedClasses: []
  2552. }),
  2553. smalltalk.HashedCollectionTest);
  2554. smalltalk.addMethod(
  2555. smalltalk.method({
  2556. selector: "testNewFromPairs",
  2557. protocol: 'tests',
  2558. fn: function (){
  2559. var self=this;
  2560. var flattenedAssociations;
  2561. return smalltalk.withContext(function($ctx1) {
  2562. var $1,$3,$2;
  2563. flattenedAssociations=["a",(1),"b",(2)];
  2564. $1=_st(_st(self._class())._collectionClass())._newFromPairs_(flattenedAssociations);
  2565. $3="a".__minus_gt((1));
  2566. $ctx1.sendIdx["->"]=1;
  2567. $2=smalltalk.HashedCollection._from_([$3,"b".__minus_gt((2))]);
  2568. self._assertSameContents_as_($1,$2);
  2569. return self}, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},smalltalk.HashedCollectionTest)})},
  2570. args: [],
  2571. 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 }.",
  2572. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class", "->"],
  2573. referencedClasses: []
  2574. }),
  2575. smalltalk.HashedCollectionTest);
  2576. smalltalk.addMethod(
  2577. smalltalk.method({
  2578. selector: "collectionClass",
  2579. protocol: 'fixture',
  2580. fn: function (){
  2581. var self=this;
  2582. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2583. return smalltalk.withContext(function($ctx1) {
  2584. return $HashedCollection();
  2585. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.HashedCollectionTest.klass)})},
  2586. args: [],
  2587. source: "collectionClass\x0a\x09^ HashedCollection",
  2588. messageSends: [],
  2589. referencedClasses: ["HashedCollection"]
  2590. }),
  2591. smalltalk.HashedCollectionTest.klass);
  2592. smalltalk.addClass('DictionaryTest', smalltalk.HashedCollectionTest, [], 'Kernel-Tests');
  2593. smalltalk.addMethod(
  2594. smalltalk.method({
  2595. selector: "collection",
  2596. protocol: 'fixture',
  2597. fn: function (){
  2598. var self=this;
  2599. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2600. return smalltalk.withContext(function($ctx1) {
  2601. var $2,$3,$1;
  2602. $2=_st($Dictionary())._new();
  2603. _st($2)._at_put_((1),(1));
  2604. $ctx1.sendIdx["at:put:"]=1;
  2605. _st($2)._at_put_("a",(2));
  2606. $ctx1.sendIdx["at:put:"]=2;
  2607. _st($2)._at_put_(true,(3));
  2608. $ctx1.sendIdx["at:put:"]=3;
  2609. _st($2)._at_put_((1).__at((3)),(-4));
  2610. $3=_st($2)._yourself();
  2611. $1=$3;
  2612. return $1;
  2613. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.DictionaryTest)})},
  2614. args: [],
  2615. 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",
  2616. messageSends: ["at:put:", "new", "@", "yourself"],
  2617. referencedClasses: ["Dictionary"]
  2618. }),
  2619. smalltalk.DictionaryTest);
  2620. smalltalk.addMethod(
  2621. smalltalk.method({
  2622. selector: "collectionSize",
  2623. protocol: 'fixture',
  2624. fn: function (){
  2625. var self=this;
  2626. return smalltalk.withContext(function($ctx1) {
  2627. return (4);
  2628. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.DictionaryTest)})},
  2629. args: [],
  2630. source: "collectionSize\x0a\x09^ 4",
  2631. messageSends: [],
  2632. referencedClasses: []
  2633. }),
  2634. smalltalk.DictionaryTest);
  2635. smalltalk.addMethod(
  2636. smalltalk.method({
  2637. selector: "collectionWithDuplicates",
  2638. protocol: 'fixture',
  2639. fn: function (){
  2640. var self=this;
  2641. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2642. return smalltalk.withContext(function($ctx1) {
  2643. var $2,$3,$1;
  2644. $2=_st($Dictionary())._new();
  2645. _st($2)._at_put_((1),(1));
  2646. $ctx1.sendIdx["at:put:"]=1;
  2647. _st($2)._at_put_("a",(2));
  2648. $ctx1.sendIdx["at:put:"]=2;
  2649. _st($2)._at_put_(true,(3));
  2650. $ctx1.sendIdx["at:put:"]=3;
  2651. _st($2)._at_put_((4),(-4));
  2652. $ctx1.sendIdx["at:put:"]=4;
  2653. _st($2)._at_put_("b",(1));
  2654. $ctx1.sendIdx["at:put:"]=5;
  2655. _st($2)._at_put_((3),(3));
  2656. $ctx1.sendIdx["at:put:"]=6;
  2657. _st($2)._at_put_(false,(12));
  2658. $3=_st($2)._yourself();
  2659. $1=$3;
  2660. return $1;
  2661. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.DictionaryTest)})},
  2662. args: [],
  2663. 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",
  2664. messageSends: ["at:put:", "new", "yourself"],
  2665. referencedClasses: ["Dictionary"]
  2666. }),
  2667. smalltalk.DictionaryTest);
  2668. smalltalk.addMethod(
  2669. smalltalk.method({
  2670. selector: "collectionWithNewValue",
  2671. protocol: 'fixture',
  2672. fn: function (){
  2673. var self=this;
  2674. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2675. return smalltalk.withContext(function($ctx1) {
  2676. var $2,$3,$1;
  2677. $2=_st($Dictionary())._new();
  2678. _st($2)._at_put_((1),(1));
  2679. $ctx1.sendIdx["at:put:"]=1;
  2680. _st($2)._at_put_("a",(2));
  2681. $ctx1.sendIdx["at:put:"]=2;
  2682. _st($2)._at_put_(true,(3));
  2683. $ctx1.sendIdx["at:put:"]=3;
  2684. _st($2)._at_put_((1).__at((3)),(-4));
  2685. $ctx1.sendIdx["at:put:"]=4;
  2686. _st($2)._at_put_("new","N");
  2687. $3=_st($2)._yourself();
  2688. $1=$3;
  2689. return $1;
  2690. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.DictionaryTest)})},
  2691. args: [],
  2692. 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",
  2693. messageSends: ["at:put:", "new", "@", "yourself"],
  2694. referencedClasses: ["Dictionary"]
  2695. }),
  2696. smalltalk.DictionaryTest);
  2697. smalltalk.addMethod(
  2698. smalltalk.method({
  2699. selector: "sampleNewValueAsCollection",
  2700. protocol: 'fixture',
  2701. fn: function (){
  2702. var self=this;
  2703. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2704. return smalltalk.withContext(function($ctx1) {
  2705. var $2,$3,$1;
  2706. $2=_st($Dictionary())._new();
  2707. _st($2)._at_put_("new","N");
  2708. $3=_st($2)._yourself();
  2709. $1=$3;
  2710. return $1;
  2711. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.DictionaryTest)})},
  2712. args: [],
  2713. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  2714. messageSends: ["at:put:", "new", "yourself"],
  2715. referencedClasses: ["Dictionary"]
  2716. }),
  2717. smalltalk.DictionaryTest);
  2718. smalltalk.addMethod(
  2719. smalltalk.method({
  2720. selector: "samplesDo:",
  2721. protocol: 'fixture',
  2722. fn: function (aBlock){
  2723. var self=this;
  2724. return smalltalk.withContext(function($ctx1) {
  2725. smalltalk.DictionaryTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  2726. _st(aBlock)._value_value_(true,(3));
  2727. $ctx1.sendIdx["value:value:"]=1;
  2728. _st(aBlock)._value_value_((1).__at((3)),(-4));
  2729. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.DictionaryTest)})},
  2730. args: ["aBlock"],
  2731. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: true value: 3.\x0a\x09aBlock value: 1@3 value: -4",
  2732. messageSends: ["samplesDo:", "value:value:", "@"],
  2733. referencedClasses: []
  2734. }),
  2735. smalltalk.DictionaryTest);
  2736. smalltalk.addMethod(
  2737. smalltalk.method({
  2738. selector: "testAccessing",
  2739. protocol: 'tests',
  2740. fn: function (){
  2741. var self=this;
  2742. var d;
  2743. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2744. return smalltalk.withContext(function($ctx1) {
  2745. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  2746. d=_st($Dictionary())._new();
  2747. _st(d)._at_put_("hello","world");
  2748. $ctx1.sendIdx["at:put:"]=1;
  2749. $1=_st(d)._at_("hello");
  2750. $ctx1.sendIdx["at:"]=1;
  2751. self._assert_equals_($1,"world");
  2752. $ctx1.sendIdx["assert:equals:"]=1;
  2753. $2=_st(d)._at_ifAbsent_("hello",(function(){
  2754. return smalltalk.withContext(function($ctx2) {
  2755. return nil;
  2756. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2757. $ctx1.sendIdx["at:ifAbsent:"]=1;
  2758. self._assert_equals_($2,"world");
  2759. $ctx1.sendIdx["assert:equals:"]=2;
  2760. self._deny_(_st(_st(d)._at_ifAbsent_("foo",(function(){
  2761. return smalltalk.withContext(function($ctx2) {
  2762. return nil;
  2763. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}))).__eq("world"));
  2764. $ctx1.sendIdx["deny:"]=1;
  2765. $3=_st(d)._includesKey_("hello");
  2766. $ctx1.sendIdx["includesKey:"]=1;
  2767. self._assert_($3);
  2768. $ctx1.sendIdx["assert:"]=1;
  2769. $4=_st(d)._includesKey_("foo");
  2770. $ctx1.sendIdx["includesKey:"]=2;
  2771. self._deny_($4);
  2772. $ctx1.sendIdx["deny:"]=2;
  2773. _st(d)._at_put_((1),(2));
  2774. $ctx1.sendIdx["at:put:"]=2;
  2775. $5=_st(d)._at_((1));
  2776. $ctx1.sendIdx["at:"]=2;
  2777. self._assert_equals_($5,(2));
  2778. $ctx1.sendIdx["assert:equals:"]=3;
  2779. $6=d;
  2780. $7=(1).__at((3));
  2781. $ctx1.sendIdx["@"]=1;
  2782. _st($6)._at_put_($7,(3));
  2783. $9=d;
  2784. $10=(1).__at((3));
  2785. $ctx1.sendIdx["@"]=2;
  2786. $8=_st($9)._at_($10);
  2787. self._assert_equals_($8,(3));
  2788. $12=d;
  2789. $13=(1).__at((3));
  2790. $ctx1.sendIdx["@"]=3;
  2791. $11=_st($12)._includesKey_($13);
  2792. $ctx1.sendIdx["includesKey:"]=3;
  2793. self._assert_($11);
  2794. self._deny_(_st(d)._includesKey_((3).__at((1))));
  2795. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},smalltalk.DictionaryTest)})},
  2796. args: [],
  2797. 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)",
  2798. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"],
  2799. referencedClasses: ["Dictionary"]
  2800. }),
  2801. smalltalk.DictionaryTest);
  2802. smalltalk.addMethod(
  2803. smalltalk.method({
  2804. selector: "testAsHashedCollection",
  2805. protocol: 'tests',
  2806. fn: function (){
  2807. var self=this;
  2808. function $HashedCollection(){return smalltalk.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2809. return smalltalk.withContext(function($ctx1) {
  2810. self._assert_(_st(_st(_st(self._collectionClass())._new())._asHashedCollection())._isMemberOf_($HashedCollection()));
  2811. return self}, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},smalltalk.DictionaryTest)})},
  2812. args: [],
  2813. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  2814. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"],
  2815. referencedClasses: ["HashedCollection"]
  2816. }),
  2817. smalltalk.DictionaryTest);
  2818. smalltalk.addMethod(
  2819. smalltalk.method({
  2820. selector: "testDynamicDictionaries",
  2821. protocol: 'tests',
  2822. fn: function (){
  2823. var self=this;
  2824. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2825. return smalltalk.withContext(function($ctx1) {
  2826. var $3,$2,$1;
  2827. $3="hello".__minus_gt((1));
  2828. $ctx1.sendIdx["->"]=1;
  2829. $2=smalltalk.HashedCollection._from_([$3]);
  2830. $1=_st($2)._asDictionary();
  2831. self._assert_equals_($1,_st($Dictionary())._with_("hello".__minus_gt((1))));
  2832. return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},smalltalk.DictionaryTest)})},
  2833. args: [],
  2834. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  2835. messageSends: ["assert:equals:", "asDictionary", "->", "with:"],
  2836. referencedClasses: ["Dictionary"]
  2837. }),
  2838. smalltalk.DictionaryTest);
  2839. smalltalk.addMethod(
  2840. smalltalk.method({
  2841. selector: "testEquality",
  2842. protocol: 'tests',
  2843. fn: function (){
  2844. var self=this;
  2845. var d1,d2;
  2846. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2847. return smalltalk.withContext(function($ctx1) {
  2848. var $2,$3,$1,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16;
  2849. $2=_st($Dictionary())._new();
  2850. $ctx1.sendIdx["new"]=1;
  2851. $3=_st($Dictionary())._new();
  2852. $ctx1.sendIdx["new"]=2;
  2853. $1=_st($2).__eq($3);
  2854. $ctx1.sendIdx["="]=1;
  2855. self._assert_($1);
  2856. $ctx1.sendIdx["assert:"]=1;
  2857. $4=_st($Dictionary())._new();
  2858. $ctx1.sendIdx["new"]=3;
  2859. _st($4)._at_put_((1),(2));
  2860. $ctx1.sendIdx["at:put:"]=1;
  2861. $5=_st($4)._yourself();
  2862. $ctx1.sendIdx["yourself"]=1;
  2863. d1=$5;
  2864. $6=_st($Dictionary())._new();
  2865. $ctx1.sendIdx["new"]=4;
  2866. _st($6)._at_put_((1),(2));
  2867. $ctx1.sendIdx["at:put:"]=2;
  2868. $7=_st($6)._yourself();
  2869. $ctx1.sendIdx["yourself"]=2;
  2870. d2=$7;
  2871. $8=_st(d1).__eq(d2);
  2872. $ctx1.sendIdx["="]=2;
  2873. self._assert_($8);
  2874. $9=_st($Dictionary())._new();
  2875. $ctx1.sendIdx["new"]=5;
  2876. _st($9)._at_put_((1),(3));
  2877. $ctx1.sendIdx["at:put:"]=3;
  2878. $10=_st($9)._yourself();
  2879. $ctx1.sendIdx["yourself"]=3;
  2880. d2=$10;
  2881. $11=_st(d1).__eq(d2);
  2882. $ctx1.sendIdx["="]=3;
  2883. self._deny_($11);
  2884. $ctx1.sendIdx["deny:"]=1;
  2885. $12=_st($Dictionary())._new();
  2886. $ctx1.sendIdx["new"]=6;
  2887. _st($12)._at_put_((2),(2));
  2888. $ctx1.sendIdx["at:put:"]=4;
  2889. $13=_st($12)._yourself();
  2890. $ctx1.sendIdx["yourself"]=4;
  2891. d2=$13;
  2892. $14=_st(d1).__eq(d2);
  2893. $ctx1.sendIdx["="]=4;
  2894. self._deny_($14);
  2895. $ctx1.sendIdx["deny:"]=2;
  2896. $15=_st($Dictionary())._new();
  2897. _st($15)._at_put_((1),(2));
  2898. $ctx1.sendIdx["at:put:"]=5;
  2899. _st($15)._at_put_((3),(4));
  2900. $16=_st($15)._yourself();
  2901. d2=$16;
  2902. self._deny_(_st(d1).__eq(d2));
  2903. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{d1:d1,d2:d2},smalltalk.DictionaryTest)})},
  2904. args: [],
  2905. source: "testEquality\x0a\x09| d1 d2 |\x0a\x0a\x09self assert: (Dictionary new = Dictionary new).\x0a\x09\x09\x0a\x09d1 := Dictionary new at: 1 put: 2; yourself.\x0a\x09d2 := Dictionary new at: 1 put: 2; yourself.\x0a\x09self assert: (d1 = d2).\x0a\x0a\x09d2 := Dictionary new at: 1 put: 3; yourself.\x0a\x09self deny: d1 = d2.\x0a\x0a\x09d2 := Dictionary new at: 2 put: 2; yourself.\x0a\x09self deny: d1 = d2.\x0a\x0a\x09d2 := Dictionary new at: 1 put: 2; at: 3 put: 4; yourself.\x0a\x09self deny: d1 = d2.",
  2906. messageSends: ["assert:", "=", "new", "at:put:", "yourself", "deny:"],
  2907. referencedClasses: ["Dictionary"]
  2908. }),
  2909. smalltalk.DictionaryTest);
  2910. smalltalk.addMethod(
  2911. smalltalk.method({
  2912. selector: "testKeys",
  2913. protocol: 'tests',
  2914. fn: function (){
  2915. var self=this;
  2916. var d;
  2917. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2918. return smalltalk.withContext(function($ctx1) {
  2919. d=_st($Dictionary())._new();
  2920. _st(d)._at_put_((1),(2));
  2921. $ctx1.sendIdx["at:put:"]=1;
  2922. _st(d)._at_put_((2),(3));
  2923. $ctx1.sendIdx["at:put:"]=2;
  2924. _st(d)._at_put_((3),(4));
  2925. self._assert_equals_(_st(d)._keys(),[(1), (2), (3)]);
  2926. return self}, function($ctx1) {$ctx1.fill(self,"testKeys",{d:d},smalltalk.DictionaryTest)})},
  2927. args: [],
  2928. source: "testKeys\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x09d at: 1 put: 2.\x0a\x09d at: 2 put: 3.\x0a\x09d at: 3 put: 4.\x0a\x0a\x09self assert: d keys equals: #(1 2 3)",
  2929. messageSends: ["new", "at:put:", "assert:equals:", "keys"],
  2930. referencedClasses: ["Dictionary"]
  2931. }),
  2932. smalltalk.DictionaryTest);
  2933. smalltalk.addMethod(
  2934. smalltalk.method({
  2935. selector: "testPointKey",
  2936. protocol: 'tests',
  2937. fn: function (){
  2938. var self=this;
  2939. var d;
  2940. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2941. return smalltalk.withContext(function($ctx1) {
  2942. var $1,$2,$4,$5,$3,$6,$7,$9,$10,$8,$11,$12,$14,$15,$13;
  2943. d=_st($Dictionary())._new();
  2944. $1=d;
  2945. $2=(1).__at((1));
  2946. $ctx1.sendIdx["@"]=1;
  2947. _st($1)._at_put_($2,"foo");
  2948. $ctx1.sendIdx["at:put:"]=1;
  2949. $4=d;
  2950. $5=(1).__at((1));
  2951. $ctx1.sendIdx["@"]=2;
  2952. $3=_st($4)._at_($5);
  2953. $ctx1.sendIdx["at:"]=1;
  2954. self._assert_equals_($3,"foo");
  2955. $ctx1.sendIdx["assert:equals:"]=1;
  2956. $6=d;
  2957. $7=(1).__at((1));
  2958. $ctx1.sendIdx["@"]=3;
  2959. _st($6)._at_put_($7,"bar");
  2960. $9=d;
  2961. $10=(1).__at((1));
  2962. $ctx1.sendIdx["@"]=4;
  2963. $8=_st($9)._at_($10);
  2964. self._assert_equals_($8,"bar");
  2965. $ctx1.sendIdx["assert:equals:"]=2;
  2966. $11=d;
  2967. $12=(1).__at((1));
  2968. $ctx1.sendIdx["@"]=5;
  2969. _st($11)._removeKey_($12);
  2970. $14=d;
  2971. $15=(1).__at((1));
  2972. $ctx1.sendIdx["@"]=6;
  2973. $13=_st($14)._at_ifAbsent_($15,(function(){
  2974. return smalltalk.withContext(function($ctx2) {
  2975. return "baz";
  2976. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2977. self._assert_equals_($13,"baz");
  2978. self._deny_(_st(d)._includesKey_((1).__at((1))));
  2979. return self}, function($ctx1) {$ctx1.fill(self,"testPointKey",{d:d},smalltalk.DictionaryTest)})},
  2980. args: [],
  2981. source: "testPointKey\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x09\x0a\x09d at: 1@1 put: 'foo'.\x0a\x09self assert: (d at: 1@1) equals: 'foo'.\x0a\x09d at: 1@1 put: 'bar'.\x0a\x09self assert: (d at: 1@1) equals: 'bar'.\x0a\x09d removeKey: 1@1.\x0a\x09self assert: (d at: 1@1 ifAbsent: [ 'baz' ]) equals: 'baz'.\x0a\x09self deny: (d includesKey: 1@1)",
  2982. messageSends: ["new", "at:put:", "@", "assert:equals:", "at:", "removeKey:", "at:ifAbsent:", "deny:", "includesKey:"],
  2983. referencedClasses: ["Dictionary"]
  2984. }),
  2985. smalltalk.DictionaryTest);
  2986. smalltalk.addMethod(
  2987. smalltalk.method({
  2988. selector: "testPrintString",
  2989. protocol: 'tests',
  2990. fn: function (){
  2991. var self=this;
  2992. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2993. return smalltalk.withContext(function($ctx1) {
  2994. var $2,$3,$1;
  2995. $2=_st($Dictionary())._new();
  2996. _st($2)._at_put_("firstname","James");
  2997. $ctx1.sendIdx["at:put:"]=1;
  2998. _st($2)._at_put_("lastname","Bond");
  2999. $3=_st($2)._printString();
  3000. $1=$3;
  3001. self._assert_equals_($1,"a Dictionary ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  3002. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{},smalltalk.DictionaryTest)})},
  3003. args: [],
  3004. source: "testPrintString\x0a\x09self\x0a\x09\x09assert: (Dictionary new\x0a\x09\x09\x09\x09\x09\x09\x09at:'firstname' put: 'James';\x0a\x09\x09\x09\x09\x09\x09\x09at:'lastname' put: 'Bond';\x0a\x09\x09\x09\x09\x09\x09\x09printString)\x0a\x09\x09equals: 'a Dictionary (''firstname'' -> ''James'' , ''lastname'' -> ''Bond'')'",
  3005. messageSends: ["assert:equals:", "at:put:", "new", "printString"],
  3006. referencedClasses: ["Dictionary"]
  3007. }),
  3008. smalltalk.DictionaryTest);
  3009. smalltalk.addMethod(
  3010. smalltalk.method({
  3011. selector: "testRemoveKey",
  3012. protocol: 'tests',
  3013. fn: function (){
  3014. var self=this;
  3015. var d,key;
  3016. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3017. return smalltalk.withContext(function($ctx1) {
  3018. var $1;
  3019. d=_st($Dictionary())._new();
  3020. _st(d)._at_put_((1),(2));
  3021. $ctx1.sendIdx["at:put:"]=1;
  3022. _st(d)._at_put_((2),(3));
  3023. $ctx1.sendIdx["at:put:"]=2;
  3024. _st(d)._at_put_((3),(4));
  3025. key=(2);
  3026. $1=_st(d)._keys();
  3027. $ctx1.sendIdx["keys"]=1;
  3028. self._assert_equals_($1,[(1), (2), (3)]);
  3029. $ctx1.sendIdx["assert:equals:"]=1;
  3030. _st(d)._removeKey_(key);
  3031. self._assert_equals_(_st(d)._keys(),[(1), (3)]);
  3032. $ctx1.sendIdx["assert:equals:"]=2;
  3033. self._assert_equals_(_st(d)._values(),[(2), (4)]);
  3034. self._deny_(_st(d)._includesKey_((2)));
  3035. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{d:d,key:key},smalltalk.DictionaryTest)})},
  3036. args: [],
  3037. source: "testRemoveKey\x0a\x09| d key |\x0a\x0a\x09d := Dictionary new.\x0a\x09d at: 1 put: 2.\x0a\x09d at: 2 put: 3.\x0a\x09d at: 3 put: 4.\x0a\x0a\x09key := 2.\x0a\x0a\x09self assert: d keys equals: #(1 2 3).\x0a\x0a\x09d removeKey: key.\x0a\x09self assert: d keys equals: #(1 3).\x0a\x09self assert: d values equals: #(2 4).\x0a\x09self deny: (d includesKey: 2)",
  3038. messageSends: ["new", "at:put:", "assert:equals:", "keys", "removeKey:", "values", "deny:", "includesKey:"],
  3039. referencedClasses: ["Dictionary"]
  3040. }),
  3041. smalltalk.DictionaryTest);
  3042. smalltalk.addMethod(
  3043. smalltalk.method({
  3044. selector: "testRemoveKeyIfAbsent",
  3045. protocol: 'tests',
  3046. fn: function (){
  3047. var self=this;
  3048. var d,key;
  3049. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3050. return smalltalk.withContext(function($ctx1) {
  3051. var $1;
  3052. d=_st($Dictionary())._new();
  3053. _st(d)._at_put_((1),(2));
  3054. $ctx1.sendIdx["at:put:"]=1;
  3055. _st(d)._at_put_((2),(3));
  3056. $ctx1.sendIdx["at:put:"]=2;
  3057. _st(d)._at_put_((3),(4));
  3058. key=(2);
  3059. self._assert_equals_(_st(d)._removeKey_(key),(3));
  3060. $ctx1.sendIdx["assert:equals:"]=1;
  3061. key=(3);
  3062. $1=_st(d)._removeKey_ifAbsent_(key,(function(){
  3063. return smalltalk.withContext(function($ctx2) {
  3064. return (42);
  3065. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  3066. $ctx1.sendIdx["removeKey:ifAbsent:"]=1;
  3067. self._assert_equals_($1,(4));
  3068. $ctx1.sendIdx["assert:equals:"]=2;
  3069. key="why";
  3070. self._assert_equals_(_st(d)._removeKey_ifAbsent_(key,(function(){
  3071. return smalltalk.withContext(function($ctx2) {
  3072. return (42);
  3073. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})})),(42));
  3074. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{d:d,key:key},smalltalk.DictionaryTest)})},
  3075. args: [],
  3076. source: "testRemoveKeyIfAbsent\x0a\x09| d key |\x0a\x0a\x09d := Dictionary new.\x0a\x09d at: 1 put: 2.\x0a\x09d at: 2 put: 3.\x0a\x09d at: 3 put: 4.\x0a\x0a\x09key := 2.\x0a\x09self assert: (d removeKey: key) equals: 3.\x0a\x0a\x09key := 3.\x0a\x09self assert: (d removeKey: key ifAbsent: [ 42 ]) equals: 4.\x0a\x0a\x09key := 'why'.\x0a\x09self assert: (d removeKey: key ifAbsent: [ 42 ] ) equals: 42.",
  3077. messageSends: ["new", "at:put:", "assert:equals:", "removeKey:", "removeKey:ifAbsent:"],
  3078. referencedClasses: ["Dictionary"]
  3079. }),
  3080. smalltalk.DictionaryTest);
  3081. smalltalk.addMethod(
  3082. smalltalk.method({
  3083. selector: "testValues",
  3084. protocol: 'tests',
  3085. fn: function (){
  3086. var self=this;
  3087. var d;
  3088. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3089. return smalltalk.withContext(function($ctx1) {
  3090. d=_st($Dictionary())._new();
  3091. _st(d)._at_put_((1),(2));
  3092. $ctx1.sendIdx["at:put:"]=1;
  3093. _st(d)._at_put_((2),(3));
  3094. $ctx1.sendIdx["at:put:"]=2;
  3095. _st(d)._at_put_((3),(4));
  3096. self._assert_equals_(_st(d)._values(),[(2), (3), (4)]);
  3097. return self}, function($ctx1) {$ctx1.fill(self,"testValues",{d:d},smalltalk.DictionaryTest)})},
  3098. args: [],
  3099. source: "testValues\x0a\x09| d |\x0a\x0a\x09d := Dictionary new.\x0a\x09d at: 1 put: 2.\x0a\x09d at: 2 put: 3.\x0a\x09d at: 3 put: 4.\x0a\x0a\x09self assert: d values equals: #(2 3 4)",
  3100. messageSends: ["new", "at:put:", "assert:equals:", "values"],
  3101. referencedClasses: ["Dictionary"]
  3102. }),
  3103. smalltalk.DictionaryTest);
  3104. smalltalk.addMethod(
  3105. smalltalk.method({
  3106. selector: "collectionClass",
  3107. protocol: 'fixture',
  3108. fn: function (){
  3109. var self=this;
  3110. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  3111. return smalltalk.withContext(function($ctx1) {
  3112. return $Dictionary();
  3113. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.DictionaryTest.klass)})},
  3114. args: [],
  3115. source: "collectionClass\x0a\x09^ Dictionary",
  3116. messageSends: [],
  3117. referencedClasses: ["Dictionary"]
  3118. }),
  3119. smalltalk.DictionaryTest.klass);
  3120. smalltalk.addClass('SequenceableCollectionTest', smalltalk.IndexableCollectionTest, [], 'Kernel-Tests');
  3121. smalltalk.addMethod(
  3122. smalltalk.method({
  3123. selector: "collectionFirst",
  3124. protocol: 'fixture',
  3125. fn: function (){
  3126. var self=this;
  3127. return smalltalk.withContext(function($ctx1) {
  3128. self._subclassResponsibility();
  3129. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.SequenceableCollectionTest)})},
  3130. args: [],
  3131. source: "collectionFirst\x0a\x09self subclassResponsibility",
  3132. messageSends: ["subclassResponsibility"],
  3133. referencedClasses: []
  3134. }),
  3135. smalltalk.SequenceableCollectionTest);
  3136. smalltalk.addMethod(
  3137. smalltalk.method({
  3138. selector: "collectionFirstTwo",
  3139. protocol: 'fixture',
  3140. fn: function (){
  3141. var self=this;
  3142. return smalltalk.withContext(function($ctx1) {
  3143. self._subclassResponsibility();
  3144. return self}, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.SequenceableCollectionTest)})},
  3145. args: [],
  3146. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  3147. messageSends: ["subclassResponsibility"],
  3148. referencedClasses: []
  3149. }),
  3150. smalltalk.SequenceableCollectionTest);
  3151. smalltalk.addMethod(
  3152. smalltalk.method({
  3153. selector: "collectionLast",
  3154. protocol: 'fixture',
  3155. fn: function (){
  3156. var self=this;
  3157. return smalltalk.withContext(function($ctx1) {
  3158. self._subclassResponsibility();
  3159. return self}, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.SequenceableCollectionTest)})},
  3160. args: [],
  3161. source: "collectionLast\x0a\x09self subclassResponsibility",
  3162. messageSends: ["subclassResponsibility"],
  3163. referencedClasses: []
  3164. }),
  3165. smalltalk.SequenceableCollectionTest);
  3166. smalltalk.addMethod(
  3167. smalltalk.method({
  3168. selector: "collectionLastTwo",
  3169. protocol: 'fixture',
  3170. fn: function (){
  3171. var self=this;
  3172. return smalltalk.withContext(function($ctx1) {
  3173. self._subclassResponsibility();
  3174. return self}, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.SequenceableCollectionTest)})},
  3175. args: [],
  3176. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  3177. messageSends: ["subclassResponsibility"],
  3178. referencedClasses: []
  3179. }),
  3180. smalltalk.SequenceableCollectionTest);
  3181. smalltalk.addMethod(
  3182. smalltalk.method({
  3183. selector: "nonIndexesDo:",
  3184. protocol: 'fixture',
  3185. fn: function (aBlock){
  3186. var self=this;
  3187. return smalltalk.withContext(function($ctx1) {
  3188. _st(aBlock)._value_((0));
  3189. $ctx1.sendIdx["value:"]=1;
  3190. _st(aBlock)._value_(_st(_st(self._collection())._size()).__plus((1)));
  3191. $ctx1.sendIdx["value:"]=2;
  3192. _st(aBlock)._value_("z");
  3193. return self}, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},smalltalk.SequenceableCollectionTest)})},
  3194. args: ["aBlock"],
  3195. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collection size + 1.\x0a\x09aBlock value: 'z'",
  3196. messageSends: ["value:", "+", "size", "collection"],
  3197. referencedClasses: []
  3198. }),
  3199. smalltalk.SequenceableCollectionTest);
  3200. smalltalk.addMethod(
  3201. smalltalk.method({
  3202. selector: "samplesDo:",
  3203. protocol: 'fixture',
  3204. fn: function (aBlock){
  3205. var self=this;
  3206. return smalltalk.withContext(function($ctx1) {
  3207. _st(aBlock)._value_value_((1),self._collectionFirst());
  3208. $ctx1.sendIdx["value:value:"]=1;
  3209. _st(aBlock)._value_value_(_st(self._collection())._size(),self._collectionLast());
  3210. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.SequenceableCollectionTest)})},
  3211. args: ["aBlock"],
  3212. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collection size value: self collectionLast",
  3213. messageSends: ["value:value:", "collectionFirst", "size", "collection", "collectionLast"],
  3214. referencedClasses: []
  3215. }),
  3216. smalltalk.SequenceableCollectionTest);
  3217. smalltalk.addMethod(
  3218. smalltalk.method({
  3219. selector: "testBeginsWith",
  3220. protocol: 'tests',
  3221. fn: function (){
  3222. var self=this;
  3223. return smalltalk.withContext(function($ctx1) {
  3224. var $2,$1,$4,$5,$3,$7,$6;
  3225. $2=self._collection();
  3226. $ctx1.sendIdx["collection"]=1;
  3227. $1=_st($2)._beginsWith_(_st(self._collectionClass())._new());
  3228. $ctx1.sendIdx["beginsWith:"]=1;
  3229. self._assert_($1);
  3230. $ctx1.sendIdx["assert:"]=1;
  3231. $4=self._collection();
  3232. $ctx1.sendIdx["collection"]=2;
  3233. $5=self._collection();
  3234. $ctx1.sendIdx["collection"]=3;
  3235. $3=_st($4)._beginsWith_($5);
  3236. $ctx1.sendIdx["beginsWith:"]=2;
  3237. self._assert_($3);
  3238. $ctx1.sendIdx["assert:"]=2;
  3239. $7=self._collection();
  3240. $ctx1.sendIdx["collection"]=4;
  3241. $6=_st($7)._beginsWith_(self._collectionFirstTwo());
  3242. $ctx1.sendIdx["beginsWith:"]=3;
  3243. self._assert_($6);
  3244. self._deny_(_st(self._collection())._beginsWith_(self._collectionLastTwo()));
  3245. return self}, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},smalltalk.SequenceableCollectionTest)})},
  3246. args: [],
  3247. 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)",
  3248. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"],
  3249. referencedClasses: []
  3250. }),
  3251. smalltalk.SequenceableCollectionTest);
  3252. smalltalk.addMethod(
  3253. smalltalk.method({
  3254. selector: "testEndsWith",
  3255. protocol: 'tests',
  3256. fn: function (){
  3257. var self=this;
  3258. return smalltalk.withContext(function($ctx1) {
  3259. var $2,$1,$4,$5,$3,$7,$6;
  3260. $2=self._collection();
  3261. $ctx1.sendIdx["collection"]=1;
  3262. $1=_st($2)._endsWith_(_st(self._collectionClass())._new());
  3263. $ctx1.sendIdx["endsWith:"]=1;
  3264. self._assert_($1);
  3265. $ctx1.sendIdx["assert:"]=1;
  3266. $4=self._collection();
  3267. $ctx1.sendIdx["collection"]=2;
  3268. $5=self._collection();
  3269. $ctx1.sendIdx["collection"]=3;
  3270. $3=_st($4)._endsWith_($5);
  3271. $ctx1.sendIdx["endsWith:"]=2;
  3272. self._assert_($3);
  3273. $ctx1.sendIdx["assert:"]=2;
  3274. $7=self._collection();
  3275. $ctx1.sendIdx["collection"]=4;
  3276. $6=_st($7)._endsWith_(self._collectionLastTwo());
  3277. $ctx1.sendIdx["endsWith:"]=3;
  3278. self._assert_($6);
  3279. self._deny_(_st(self._collection())._endsWith_(self._collectionFirstTwo()));
  3280. return self}, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},smalltalk.SequenceableCollectionTest)})},
  3281. args: [],
  3282. 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)",
  3283. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"],
  3284. referencedClasses: []
  3285. }),
  3286. smalltalk.SequenceableCollectionTest);
  3287. smalltalk.addMethod(
  3288. smalltalk.method({
  3289. selector: "testFirst",
  3290. protocol: 'tests',
  3291. fn: function (){
  3292. var self=this;
  3293. return smalltalk.withContext(function($ctx1) {
  3294. self._assert_equals_(_st(self._collection())._first(),self._collectionFirst());
  3295. return self}, function($ctx1) {$ctx1.fill(self,"testFirst",{},smalltalk.SequenceableCollectionTest)})},
  3296. args: [],
  3297. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  3298. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"],
  3299. referencedClasses: []
  3300. }),
  3301. smalltalk.SequenceableCollectionTest);
  3302. smalltalk.addMethod(
  3303. smalltalk.method({
  3304. selector: "testFirstN",
  3305. protocol: 'tests',
  3306. fn: function (){
  3307. var self=this;
  3308. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3309. return smalltalk.withContext(function($ctx1) {
  3310. var $2,$1,$4,$3,$6,$8,$7,$5,$9;
  3311. $2=self._collection();
  3312. $ctx1.sendIdx["collection"]=1;
  3313. $1=_st($2)._first_((2));
  3314. $ctx1.sendIdx["first:"]=1;
  3315. self._assert_equals_($1,self._collectionFirstTwo());
  3316. $ctx1.sendIdx["assert:equals:"]=1;
  3317. $4=self._collection();
  3318. $ctx1.sendIdx["collection"]=2;
  3319. $3=_st($4)._first_((0));
  3320. $ctx1.sendIdx["first:"]=2;
  3321. self._assert_equals_($3,_st(self._collectionClass())._new());
  3322. $ctx1.sendIdx["assert:equals:"]=2;
  3323. $6=self._collection();
  3324. $ctx1.sendIdx["collection"]=3;
  3325. $8=self._collection();
  3326. $ctx1.sendIdx["collection"]=4;
  3327. $7=_st($8)._size();
  3328. $5=_st($6)._first_($7);
  3329. $ctx1.sendIdx["first:"]=3;
  3330. $9=self._collection();
  3331. $ctx1.sendIdx["collection"]=5;
  3332. self._assert_equals_($5,$9);
  3333. self._should_raise_((function(){
  3334. return smalltalk.withContext(function($ctx2) {
  3335. return _st(self._collection())._first_((33));
  3336. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3337. return self}, function($ctx1) {$ctx1.fill(self,"testFirstN",{},smalltalk.SequenceableCollectionTest)})},
  3338. args: [],
  3339. source: "testFirstN\x0a\x09self \x0a\x09\x09assert: (self collection first: 2)\x0a\x09\x09equals: self collectionFirstTwo.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection first: 0)\x0a\x09\x09equals: self collectionClass new.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection first: self collection size)\x0a\x09\x09equals: self collection.\x0a\x09\x09\x0a\x09self should: [ self collection first: 33 ] raise: Error",
  3340. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "size", "should:raise:"],
  3341. referencedClasses: ["Error"]
  3342. }),
  3343. smalltalk.SequenceableCollectionTest);
  3344. smalltalk.addMethod(
  3345. smalltalk.method({
  3346. selector: "testFourth",
  3347. protocol: 'tests',
  3348. fn: function (){
  3349. var self=this;
  3350. return smalltalk.withContext(function($ctx1) {
  3351. var $2,$1;
  3352. $2=self._collection();
  3353. $ctx1.sendIdx["collection"]=1;
  3354. $1=_st($2)._fourth();
  3355. self._assert_equals_($1,_st(self._collection())._at_((4)));
  3356. return self}, function($ctx1) {$ctx1.fill(self,"testFourth",{},smalltalk.SequenceableCollectionTest)})},
  3357. args: [],
  3358. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  3359. messageSends: ["assert:equals:", "fourth", "collection", "at:"],
  3360. referencedClasses: []
  3361. }),
  3362. smalltalk.SequenceableCollectionTest);
  3363. smalltalk.addMethod(
  3364. smalltalk.method({
  3365. selector: "testLast",
  3366. protocol: 'tests',
  3367. fn: function (){
  3368. var self=this;
  3369. return smalltalk.withContext(function($ctx1) {
  3370. self._assert_equals_(_st(self._collection())._last(),self._collectionLast());
  3371. return self}, function($ctx1) {$ctx1.fill(self,"testLast",{},smalltalk.SequenceableCollectionTest)})},
  3372. args: [],
  3373. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  3374. messageSends: ["assert:equals:", "last", "collection", "collectionLast"],
  3375. referencedClasses: []
  3376. }),
  3377. smalltalk.SequenceableCollectionTest);
  3378. smalltalk.addMethod(
  3379. smalltalk.method({
  3380. selector: "testLastN",
  3381. protocol: 'tests',
  3382. fn: function (){
  3383. var self=this;
  3384. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3385. return smalltalk.withContext(function($ctx1) {
  3386. var $2,$1,$4,$3,$6,$8,$7,$5,$9;
  3387. $2=self._collection();
  3388. $ctx1.sendIdx["collection"]=1;
  3389. $1=_st($2)._last_((2));
  3390. $ctx1.sendIdx["last:"]=1;
  3391. self._assert_equals_($1,self._collectionLastTwo());
  3392. $ctx1.sendIdx["assert:equals:"]=1;
  3393. $4=self._collection();
  3394. $ctx1.sendIdx["collection"]=2;
  3395. $3=_st($4)._last_((0));
  3396. $ctx1.sendIdx["last:"]=2;
  3397. self._assert_equals_($3,_st(self._collectionClass())._new());
  3398. $ctx1.sendIdx["assert:equals:"]=2;
  3399. $6=self._collection();
  3400. $ctx1.sendIdx["collection"]=3;
  3401. $8=self._collection();
  3402. $ctx1.sendIdx["collection"]=4;
  3403. $7=_st($8)._size();
  3404. $5=_st($6)._last_($7);
  3405. $ctx1.sendIdx["last:"]=3;
  3406. $9=self._collection();
  3407. $ctx1.sendIdx["collection"]=5;
  3408. self._assert_equals_($5,$9);
  3409. self._should_raise_((function(){
  3410. return smalltalk.withContext(function($ctx2) {
  3411. return _st(self._collection())._last_((33));
  3412. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3413. return self}, function($ctx1) {$ctx1.fill(self,"testLastN",{},smalltalk.SequenceableCollectionTest)})},
  3414. args: [],
  3415. source: "testLastN\x0a\x09self \x0a\x09\x09assert: (self collection last: 2) \x0a\x09\x09equals: self collectionLastTwo.\x0a\x09\x09\x0a\x09self\x0a\x09\x09assert: (self collection last: 0)\x0a\x09\x09equals: self collectionClass new.\x0a\x0a\x09self\x0a\x09\x09assert: (self collection last: self collection size)\x0a\x09\x09equals: self collection.\x0a\x0a\x09self should: [ self collection last: 33 ] raise: Error",
  3416. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "size", "should:raise:"],
  3417. referencedClasses: ["Error"]
  3418. }),
  3419. smalltalk.SequenceableCollectionTest);
  3420. smalltalk.addMethod(
  3421. smalltalk.method({
  3422. selector: "testSecond",
  3423. protocol: 'tests',
  3424. fn: function (){
  3425. var self=this;
  3426. return smalltalk.withContext(function($ctx1) {
  3427. var $2,$1;
  3428. $2=self._collection();
  3429. $ctx1.sendIdx["collection"]=1;
  3430. $1=_st($2)._second();
  3431. self._assert_equals_($1,_st(self._collection())._at_((2)));
  3432. return self}, function($ctx1) {$ctx1.fill(self,"testSecond",{},smalltalk.SequenceableCollectionTest)})},
  3433. args: [],
  3434. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  3435. messageSends: ["assert:equals:", "second", "collection", "at:"],
  3436. referencedClasses: []
  3437. }),
  3438. smalltalk.SequenceableCollectionTest);
  3439. smalltalk.addMethod(
  3440. smalltalk.method({
  3441. selector: "testThird",
  3442. protocol: 'tests',
  3443. fn: function (){
  3444. var self=this;
  3445. return smalltalk.withContext(function($ctx1) {
  3446. var $2,$1;
  3447. $2=self._collection();
  3448. $ctx1.sendIdx["collection"]=1;
  3449. $1=_st($2)._third();
  3450. self._assert_equals_($1,_st(self._collection())._at_((3)));
  3451. return self}, function($ctx1) {$ctx1.fill(self,"testThird",{},smalltalk.SequenceableCollectionTest)})},
  3452. args: [],
  3453. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  3454. messageSends: ["assert:equals:", "third", "collection", "at:"],
  3455. referencedClasses: []
  3456. }),
  3457. smalltalk.SequenceableCollectionTest);
  3458. smalltalk.addClass('ArrayTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  3459. smalltalk.addMethod(
  3460. smalltalk.method({
  3461. selector: "collection",
  3462. protocol: 'fixture',
  3463. fn: function (){
  3464. var self=this;
  3465. return smalltalk.withContext(function($ctx1) {
  3466. var $1;
  3467. $1=[(1), (2), (3), (-4)];
  3468. return $1;
  3469. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.ArrayTest)})},
  3470. args: [],
  3471. source: "collection\x0a\x09^ #(1 2 3 -4)",
  3472. messageSends: [],
  3473. referencedClasses: []
  3474. }),
  3475. smalltalk.ArrayTest);
  3476. smalltalk.addMethod(
  3477. smalltalk.method({
  3478. selector: "collectionFirst",
  3479. protocol: 'fixture',
  3480. fn: function (){
  3481. var self=this;
  3482. return smalltalk.withContext(function($ctx1) {
  3483. return (1);
  3484. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.ArrayTest)})},
  3485. args: [],
  3486. source: "collectionFirst\x0a\x09^ 1",
  3487. messageSends: [],
  3488. referencedClasses: []
  3489. }),
  3490. smalltalk.ArrayTest);
  3491. smalltalk.addMethod(
  3492. smalltalk.method({
  3493. selector: "collectionFirstTwo",
  3494. protocol: 'fixture',
  3495. fn: function (){
  3496. var self=this;
  3497. return smalltalk.withContext(function($ctx1) {
  3498. var $1;
  3499. $1=[(1), (2)];
  3500. return $1;
  3501. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.ArrayTest)})},
  3502. args: [],
  3503. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  3504. messageSends: [],
  3505. referencedClasses: []
  3506. }),
  3507. smalltalk.ArrayTest);
  3508. smalltalk.addMethod(
  3509. smalltalk.method({
  3510. selector: "collectionLast",
  3511. protocol: 'fixture',
  3512. fn: function (){
  3513. var self=this;
  3514. return smalltalk.withContext(function($ctx1) {
  3515. return (-4);
  3516. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.ArrayTest)})},
  3517. args: [],
  3518. source: "collectionLast\x0a\x09^ -4",
  3519. messageSends: [],
  3520. referencedClasses: []
  3521. }),
  3522. smalltalk.ArrayTest);
  3523. smalltalk.addMethod(
  3524. smalltalk.method({
  3525. selector: "collectionLastTwo",
  3526. protocol: 'fixture',
  3527. fn: function (){
  3528. var self=this;
  3529. return smalltalk.withContext(function($ctx1) {
  3530. var $1;
  3531. $1=[(3), (-4)];
  3532. return $1;
  3533. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.ArrayTest)})},
  3534. args: [],
  3535. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  3536. messageSends: [],
  3537. referencedClasses: []
  3538. }),
  3539. smalltalk.ArrayTest);
  3540. smalltalk.addMethod(
  3541. smalltalk.method({
  3542. selector: "collectionSize",
  3543. protocol: 'fixture',
  3544. fn: function (){
  3545. var self=this;
  3546. return smalltalk.withContext(function($ctx1) {
  3547. return (4);
  3548. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.ArrayTest)})},
  3549. args: [],
  3550. source: "collectionSize\x0a\x09^ 4",
  3551. messageSends: [],
  3552. referencedClasses: []
  3553. }),
  3554. smalltalk.ArrayTest);
  3555. smalltalk.addMethod(
  3556. smalltalk.method({
  3557. selector: "collectionWithDuplicates",
  3558. protocol: 'fixture',
  3559. fn: function (){
  3560. var self=this;
  3561. return smalltalk.withContext(function($ctx1) {
  3562. var $1;
  3563. $1=["a", "b", "c", (1), (2), (1), "a"];
  3564. return $1;
  3565. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.ArrayTest)})},
  3566. args: [],
  3567. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a')",
  3568. messageSends: [],
  3569. referencedClasses: []
  3570. }),
  3571. smalltalk.ArrayTest);
  3572. smalltalk.addMethod(
  3573. smalltalk.method({
  3574. selector: "collectionWithNewValue",
  3575. protocol: 'fixture',
  3576. fn: function (){
  3577. var self=this;
  3578. return smalltalk.withContext(function($ctx1) {
  3579. var $1;
  3580. $1=[(1), (2), (3), (-4), "N"];
  3581. return $1;
  3582. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.ArrayTest)})},
  3583. args: [],
  3584. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  3585. messageSends: [],
  3586. referencedClasses: []
  3587. }),
  3588. smalltalk.ArrayTest);
  3589. smalltalk.addMethod(
  3590. smalltalk.method({
  3591. selector: "sampleNewIndex",
  3592. protocol: 'fixture',
  3593. fn: function (){
  3594. var self=this;
  3595. return smalltalk.withContext(function($ctx1) {
  3596. return (5);
  3597. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},smalltalk.ArrayTest)})},
  3598. args: [],
  3599. source: "sampleNewIndex\x0a\x09^ 5",
  3600. messageSends: [],
  3601. referencedClasses: []
  3602. }),
  3603. smalltalk.ArrayTest);
  3604. smalltalk.addMethod(
  3605. smalltalk.method({
  3606. selector: "samplesDo:",
  3607. protocol: 'fixture',
  3608. fn: function (aBlock){
  3609. var self=this;
  3610. return smalltalk.withContext(function($ctx1) {
  3611. smalltalk.ArrayTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  3612. _st(aBlock)._value_value_((3),(3));
  3613. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.ArrayTest)})},
  3614. args: ["aBlock"],
  3615. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  3616. messageSends: ["samplesDo:", "value:value:"],
  3617. referencedClasses: []
  3618. }),
  3619. smalltalk.ArrayTest);
  3620. smalltalk.addMethod(
  3621. smalltalk.method({
  3622. selector: "testAdd",
  3623. protocol: 'tests',
  3624. fn: function (){
  3625. var self=this;
  3626. var array;
  3627. return smalltalk.withContext(function($ctx1) {
  3628. array=self._collection();
  3629. _st(array)._add_((6));
  3630. self._assert_equals_(_st(array)._last(),(6));
  3631. return self}, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},smalltalk.ArrayTest)})},
  3632. args: [],
  3633. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  3634. messageSends: ["collection", "add:", "assert:equals:", "last"],
  3635. referencedClasses: []
  3636. }),
  3637. smalltalk.ArrayTest);
  3638. smalltalk.addMethod(
  3639. smalltalk.method({
  3640. selector: "testAddFirst",
  3641. protocol: 'tests',
  3642. fn: function (){
  3643. var self=this;
  3644. return smalltalk.withContext(function($ctx1) {
  3645. var $1,$2;
  3646. $1=self._collection();
  3647. _st($1)._addFirst_((0));
  3648. $2=_st($1)._yourself();
  3649. self._assert_equals_(_st($2)._first(),(0));
  3650. return self}, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},smalltalk.ArrayTest)})},
  3651. args: [],
  3652. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  3653. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"],
  3654. referencedClasses: []
  3655. }),
  3656. smalltalk.ArrayTest);
  3657. smalltalk.addMethod(
  3658. smalltalk.method({
  3659. selector: "testPrintString",
  3660. protocol: 'tests',
  3661. fn: function (){
  3662. var self=this;
  3663. var array;
  3664. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  3665. return smalltalk.withContext(function($ctx1) {
  3666. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  3667. array=_st($Array())._new();
  3668. $1=_st(array)._printString();
  3669. $ctx1.sendIdx["printString"]=1;
  3670. self._assert_equals_($1,"an Array ()");
  3671. $ctx1.sendIdx["assert:equals:"]=1;
  3672. $2=array;
  3673. _st($2)._add_((1));
  3674. $ctx1.sendIdx["add:"]=1;
  3675. $3=_st($2)._add_((3));
  3676. $ctx1.sendIdx["add:"]=2;
  3677. $4=_st(array)._printString();
  3678. $ctx1.sendIdx["printString"]=2;
  3679. self._assert_equals_($4,"an Array (1 3)");
  3680. $ctx1.sendIdx["assert:equals:"]=2;
  3681. _st(array)._add_("foo");
  3682. $5=_st(array)._printString();
  3683. $ctx1.sendIdx["printString"]=3;
  3684. self._assert_equals_($5,"an Array (1 3 'foo')");
  3685. $ctx1.sendIdx["assert:equals:"]=3;
  3686. $6=array;
  3687. _st($6)._remove_((1));
  3688. $ctx1.sendIdx["remove:"]=1;
  3689. $7=_st($6)._remove_((3));
  3690. $8=_st(array)._printString();
  3691. $ctx1.sendIdx["printString"]=4;
  3692. self._assert_equals_($8,"an Array ('foo')");
  3693. $ctx1.sendIdx["assert:equals:"]=4;
  3694. _st(array)._addLast_((3));
  3695. $ctx1.sendIdx["addLast:"]=1;
  3696. $9=_st(array)._printString();
  3697. $ctx1.sendIdx["printString"]=5;
  3698. self._assert_equals_($9,"an Array ('foo' 3)");
  3699. $ctx1.sendIdx["assert:equals:"]=5;
  3700. _st(array)._addLast_((3));
  3701. self._assert_equals_(_st(array)._printString(),"an Array ('foo' 3 3)");
  3702. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},smalltalk.ArrayTest)})},
  3703. args: [],
  3704. 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)'.",
  3705. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"],
  3706. referencedClasses: ["Array"]
  3707. }),
  3708. smalltalk.ArrayTest);
  3709. smalltalk.addMethod(
  3710. smalltalk.method({
  3711. selector: "testRemove",
  3712. protocol: 'tests',
  3713. fn: function (){
  3714. var self=this;
  3715. var array;
  3716. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  3717. return smalltalk.withContext(function($ctx1) {
  3718. array=[(1), (2), (3), (4), (5)];
  3719. _st(array)._remove_((3));
  3720. $ctx1.sendIdx["remove:"]=1;
  3721. self._assert_equals_(array,[(1), (2), (4), (5)]);
  3722. self._should_raise_((function(){
  3723. return smalltalk.withContext(function($ctx2) {
  3724. return _st(array)._remove_((3));
  3725. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  3726. return self}, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},smalltalk.ArrayTest)})},
  3727. args: [],
  3728. 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",
  3729. messageSends: ["remove:", "assert:equals:", "should:raise:"],
  3730. referencedClasses: ["Error"]
  3731. }),
  3732. smalltalk.ArrayTest);
  3733. smalltalk.addMethod(
  3734. smalltalk.method({
  3735. selector: "testRemoveFromTo",
  3736. protocol: 'tests',
  3737. fn: function (){
  3738. var self=this;
  3739. return smalltalk.withContext(function($ctx1) {
  3740. var $1,$2;
  3741. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  3742. $ctx1.sendIdx["removeFrom:to:"]=1;
  3743. self._assert_equals_($1,[(4)]);
  3744. $ctx1.sendIdx["assert:equals:"]=1;
  3745. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  3746. $ctx1.sendIdx["removeFrom:to:"]=2;
  3747. self._assert_equals_($2,[(1), (4)]);
  3748. $ctx1.sendIdx["assert:equals:"]=2;
  3749. self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  3750. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},smalltalk.ArrayTest)})},
  3751. args: [],
  3752. 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)",
  3753. messageSends: ["assert:equals:", "removeFrom:to:"],
  3754. referencedClasses: []
  3755. }),
  3756. smalltalk.ArrayTest);
  3757. smalltalk.addMethod(
  3758. smalltalk.method({
  3759. selector: "testRemoveIndex",
  3760. protocol: 'tests',
  3761. fn: function (){
  3762. var self=this;
  3763. return smalltalk.withContext(function($ctx1) {
  3764. var $1,$2;
  3765. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  3766. $ctx1.sendIdx["removeIndex:"]=1;
  3767. self._assert_equals_($1,[(1), (3), (4)]);
  3768. $ctx1.sendIdx["assert:equals:"]=1;
  3769. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  3770. $ctx1.sendIdx["removeIndex:"]=2;
  3771. self._assert_equals_($2,[(2), (3), (4)]);
  3772. $ctx1.sendIdx["assert:equals:"]=2;
  3773. self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  3774. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},smalltalk.ArrayTest)})},
  3775. args: [],
  3776. 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: #()",
  3777. messageSends: ["assert:equals:", "removeIndex:"],
  3778. referencedClasses: []
  3779. }),
  3780. smalltalk.ArrayTest);
  3781. smalltalk.addMethod(
  3782. smalltalk.method({
  3783. selector: "testRemoveLast",
  3784. protocol: 'tests',
  3785. fn: function (){
  3786. var self=this;
  3787. var array;
  3788. return smalltalk.withContext(function($ctx1) {
  3789. array=[(1), (2)];
  3790. _st(array)._removeLast();
  3791. self._assert_equals_(_st(array)._last(),(1));
  3792. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},smalltalk.ArrayTest)})},
  3793. args: [],
  3794. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  3795. messageSends: ["removeLast", "assert:equals:", "last"],
  3796. referencedClasses: []
  3797. }),
  3798. smalltalk.ArrayTest);
  3799. smalltalk.addMethod(
  3800. smalltalk.method({
  3801. selector: "testReversed",
  3802. protocol: 'tests',
  3803. fn: function (){
  3804. var self=this;
  3805. var array;
  3806. return smalltalk.withContext(function($ctx1) {
  3807. array=[(5), (4), (3), (2), (1)];
  3808. self._assert_equals_(_st(array)._reversed(),[(1), (2), (3), (4), (5)]);
  3809. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},smalltalk.ArrayTest)})},
  3810. args: [],
  3811. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  3812. messageSends: ["assert:equals:", "reversed"],
  3813. referencedClasses: []
  3814. }),
  3815. smalltalk.ArrayTest);
  3816. smalltalk.addMethod(
  3817. smalltalk.method({
  3818. selector: "testSort",
  3819. protocol: 'tests',
  3820. fn: function (){
  3821. var self=this;
  3822. var array;
  3823. return smalltalk.withContext(function($ctx1) {
  3824. array=[(3), (1), (4), (5), (2)];
  3825. _st(array)._sort();
  3826. self._assert_equals_(array,[(1), (2), (3), (4), (5)]);
  3827. return self}, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},smalltalk.ArrayTest)})},
  3828. args: [],
  3829. source: "testSort\x0a\x09| array |\x0a\x09array := #(3 1 4 5 2). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 2 3 4 5)",
  3830. messageSends: ["sort", "assert:equals:"],
  3831. referencedClasses: []
  3832. }),
  3833. smalltalk.ArrayTest);
  3834. smalltalk.addMethod(
  3835. smalltalk.method({
  3836. selector: "collectionClass",
  3837. protocol: 'fixture',
  3838. fn: function (){
  3839. var self=this;
  3840. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  3841. return smalltalk.withContext(function($ctx1) {
  3842. return $Array();
  3843. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayTest.klass)})},
  3844. args: [],
  3845. source: "collectionClass\x0a\x09^ Array",
  3846. messageSends: [],
  3847. referencedClasses: ["Array"]
  3848. }),
  3849. smalltalk.ArrayTest.klass);
  3850. smalltalk.addClass('StringTest', smalltalk.SequenceableCollectionTest, [], 'Kernel-Tests');
  3851. smalltalk.addMethod(
  3852. smalltalk.method({
  3853. selector: "collection",
  3854. protocol: 'fixture',
  3855. fn: function (){
  3856. var self=this;
  3857. return smalltalk.withContext(function($ctx1) {
  3858. return "hello";
  3859. }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.StringTest)})},
  3860. args: [],
  3861. source: "collection\x0a\x09^ 'hello'",
  3862. messageSends: [],
  3863. referencedClasses: []
  3864. }),
  3865. smalltalk.StringTest);
  3866. smalltalk.addMethod(
  3867. smalltalk.method({
  3868. selector: "collectionFirst",
  3869. protocol: 'fixture',
  3870. fn: function (){
  3871. var self=this;
  3872. return smalltalk.withContext(function($ctx1) {
  3873. return "h";
  3874. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},smalltalk.StringTest)})},
  3875. args: [],
  3876. source: "collectionFirst\x0a\x09^ 'h'",
  3877. messageSends: [],
  3878. referencedClasses: []
  3879. }),
  3880. smalltalk.StringTest);
  3881. smalltalk.addMethod(
  3882. smalltalk.method({
  3883. selector: "collectionFirstTwo",
  3884. protocol: 'fixture',
  3885. fn: function (){
  3886. var self=this;
  3887. return smalltalk.withContext(function($ctx1) {
  3888. return "he";
  3889. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},smalltalk.StringTest)})},
  3890. args: [],
  3891. source: "collectionFirstTwo\x0a\x09^ 'he'",
  3892. messageSends: [],
  3893. referencedClasses: []
  3894. }),
  3895. smalltalk.StringTest);
  3896. smalltalk.addMethod(
  3897. smalltalk.method({
  3898. selector: "collectionLast",
  3899. protocol: 'fixture',
  3900. fn: function (){
  3901. var self=this;
  3902. return smalltalk.withContext(function($ctx1) {
  3903. return "o";
  3904. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},smalltalk.StringTest)})},
  3905. args: [],
  3906. source: "collectionLast\x0a\x09^ 'o'",
  3907. messageSends: [],
  3908. referencedClasses: []
  3909. }),
  3910. smalltalk.StringTest);
  3911. smalltalk.addMethod(
  3912. smalltalk.method({
  3913. selector: "collectionLastTwo",
  3914. protocol: 'fixture',
  3915. fn: function (){
  3916. var self=this;
  3917. return smalltalk.withContext(function($ctx1) {
  3918. return "lo";
  3919. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},smalltalk.StringTest)})},
  3920. args: [],
  3921. source: "collectionLastTwo\x0a\x09^ 'lo'",
  3922. messageSends: [],
  3923. referencedClasses: []
  3924. }),
  3925. smalltalk.StringTest);
  3926. smalltalk.addMethod(
  3927. smalltalk.method({
  3928. selector: "collectionSize",
  3929. protocol: 'fixture',
  3930. fn: function (){
  3931. var self=this;
  3932. return smalltalk.withContext(function($ctx1) {
  3933. return (5);
  3934. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},smalltalk.StringTest)})},
  3935. args: [],
  3936. source: "collectionSize\x0a\x09^ 5",
  3937. messageSends: [],
  3938. referencedClasses: []
  3939. }),
  3940. smalltalk.StringTest);
  3941. smalltalk.addMethod(
  3942. smalltalk.method({
  3943. selector: "collectionWithDuplicates",
  3944. protocol: 'fixture',
  3945. fn: function (){
  3946. var self=this;
  3947. return smalltalk.withContext(function($ctx1) {
  3948. return "abbaerte";
  3949. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.StringTest)})},
  3950. args: [],
  3951. source: "collectionWithDuplicates\x0a\x09^ 'abbaerte'",
  3952. messageSends: [],
  3953. referencedClasses: []
  3954. }),
  3955. smalltalk.StringTest);
  3956. smalltalk.addMethod(
  3957. smalltalk.method({
  3958. selector: "collectionWithNewValue",
  3959. protocol: 'fixture',
  3960. fn: function (){
  3961. var self=this;
  3962. return smalltalk.withContext(function($ctx1) {
  3963. return "helloN";
  3964. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.StringTest)})},
  3965. args: [],
  3966. source: "collectionWithNewValue\x0a\x09^ 'helloN'",
  3967. messageSends: [],
  3968. referencedClasses: []
  3969. }),
  3970. smalltalk.StringTest);
  3971. smalltalk.addMethod(
  3972. smalltalk.method({
  3973. selector: "sampleNewValueAsCollection",
  3974. protocol: 'fixture',
  3975. fn: function (){
  3976. var self=this;
  3977. return smalltalk.withContext(function($ctx1) {
  3978. return "N";
  3979. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},smalltalk.StringTest)})},
  3980. args: [],
  3981. source: "sampleNewValueAsCollection\x0a\x09\x0a\x09^ 'N'",
  3982. messageSends: [],
  3983. referencedClasses: []
  3984. }),
  3985. smalltalk.StringTest);
  3986. smalltalk.addMethod(
  3987. smalltalk.method({
  3988. selector: "samplesDo:",
  3989. protocol: 'fixture',
  3990. fn: function (aBlock){
  3991. var self=this;
  3992. return smalltalk.withContext(function($ctx1) {
  3993. smalltalk.StringTest.superclass.fn.prototype._samplesDo_.apply(_st(self), [aBlock]);
  3994. _st(aBlock)._value_value_((3),"l");
  3995. return self}, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},smalltalk.StringTest)})},
  3996. args: ["aBlock"],
  3997. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  3998. messageSends: ["samplesDo:", "value:value:"],
  3999. referencedClasses: []
  4000. }),
  4001. smalltalk.StringTest);
  4002. smalltalk.addMethod(
  4003. smalltalk.method({
  4004. selector: "testAddAll",
  4005. protocol: 'tests',
  4006. fn: function (){
  4007. var self=this;
  4008. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4009. return smalltalk.withContext(function($ctx1) {
  4010. var $1;
  4011. self._should_raise_((function(){
  4012. return smalltalk.withContext(function($ctx2) {
  4013. $1=self._collection();
  4014. $ctx2.sendIdx["collection"]=1;
  4015. return _st($1)._addAll_(self._collection());
  4016. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4017. return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.StringTest)})},
  4018. args: [],
  4019. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  4020. messageSends: ["should:raise:", "addAll:", "collection"],
  4021. referencedClasses: ["Error"]
  4022. }),
  4023. smalltalk.StringTest);
  4024. smalltalk.addMethod(
  4025. smalltalk.method({
  4026. selector: "testAddRemove",
  4027. protocol: 'tests',
  4028. fn: function (){
  4029. var self=this;
  4030. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4031. return smalltalk.withContext(function($ctx1) {
  4032. self._should_raise_((function(){
  4033. return smalltalk.withContext(function($ctx2) {
  4034. return "hello"._add_("a");
  4035. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4036. $ctx1.sendIdx["should:raise:"]=1;
  4037. self._should_raise_((function(){
  4038. return smalltalk.withContext(function($ctx2) {
  4039. return "hello"._remove_("h");
  4040. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  4041. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},smalltalk.StringTest)})},
  4042. args: [],
  4043. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  4044. messageSends: ["should:raise:", "add:", "remove:"],
  4045. referencedClasses: ["Error"]
  4046. }),
  4047. smalltalk.StringTest);
  4048. smalltalk.addMethod(
  4049. smalltalk.method({
  4050. selector: "testAsArray",
  4051. protocol: 'tests',
  4052. fn: function (){
  4053. var self=this;
  4054. return smalltalk.withContext(function($ctx1) {
  4055. self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  4056. return self}, function($ctx1) {$ctx1.fill(self,"testAsArray",{},smalltalk.StringTest)})},
  4057. args: [],
  4058. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  4059. messageSends: ["assert:equals:", "asArray"],
  4060. referencedClasses: []
  4061. }),
  4062. smalltalk.StringTest);
  4063. smalltalk.addMethod(
  4064. smalltalk.method({
  4065. selector: "testAsLowerCase",
  4066. protocol: 'tests',
  4067. fn: function (){
  4068. var self=this;
  4069. return smalltalk.withContext(function($ctx1) {
  4070. self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  4071. return self}, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},smalltalk.StringTest)})},
  4072. args: [],
  4073. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  4074. messageSends: ["assert:equals:", "asLowercase"],
  4075. referencedClasses: []
  4076. }),
  4077. smalltalk.StringTest);
  4078. smalltalk.addMethod(
  4079. smalltalk.method({
  4080. selector: "testAsNumber",
  4081. protocol: 'tests',
  4082. fn: function (){
  4083. var self=this;
  4084. return smalltalk.withContext(function($ctx1) {
  4085. var $1,$2;
  4086. $1="3"._asNumber();
  4087. $ctx1.sendIdx["asNumber"]=1;
  4088. self._assert_equals_($1,(3));
  4089. $ctx1.sendIdx["assert:equals:"]=1;
  4090. $2="-3"._asNumber();
  4091. $ctx1.sendIdx["asNumber"]=2;
  4092. self._assert_equals_($2,(-3));
  4093. $ctx1.sendIdx["assert:equals:"]=2;
  4094. self._assert_equals_("-1.5"._asNumber(),(-1.5));
  4095. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.StringTest)})},
  4096. args: [],
  4097. 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.",
  4098. messageSends: ["assert:equals:", "asNumber"],
  4099. referencedClasses: []
  4100. }),
  4101. smalltalk.StringTest);
  4102. smalltalk.addMethod(
  4103. smalltalk.method({
  4104. selector: "testAsUpperCase",
  4105. protocol: 'tests',
  4106. fn: function (){
  4107. var self=this;
  4108. return smalltalk.withContext(function($ctx1) {
  4109. self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  4110. return self}, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},smalltalk.StringTest)})},
  4111. args: [],
  4112. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  4113. messageSends: ["assert:equals:", "asUppercase"],
  4114. referencedClasses: []
  4115. }),
  4116. smalltalk.StringTest);
  4117. smalltalk.addMethod(
  4118. smalltalk.method({
  4119. selector: "testAsciiValue",
  4120. protocol: 'tests',
  4121. fn: function (){
  4122. var self=this;
  4123. var characterA,characterU;
  4124. return smalltalk.withContext(function($ctx1) {
  4125. var $1;
  4126. characterA="A";
  4127. characterU="U";
  4128. $1=_st(characterA)._asciiValue();
  4129. $ctx1.sendIdx["asciiValue"]=1;
  4130. self._assert_equals_($1,(65));
  4131. $ctx1.sendIdx["assert:equals:"]=1;
  4132. self._assert_equals_(_st(characterU)._asciiValue(),(85));
  4133. return self}, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},smalltalk.StringTest)})},
  4134. args: [],
  4135. 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",
  4136. messageSends: ["assert:equals:", "asciiValue"],
  4137. referencedClasses: []
  4138. }),
  4139. smalltalk.StringTest);
  4140. smalltalk.addMethod(
  4141. smalltalk.method({
  4142. selector: "testAtPut",
  4143. protocol: 'tests',
  4144. fn: function (){
  4145. var self=this;
  4146. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4147. return smalltalk.withContext(function($ctx1) {
  4148. self._should_raise_((function(){
  4149. return smalltalk.withContext(function($ctx2) {
  4150. return "hello"._at_put_((1),"a");
  4151. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4152. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{},smalltalk.StringTest)})},
  4153. args: [],
  4154. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  4155. messageSends: ["should:raise:", "at:put:"],
  4156. referencedClasses: ["Error"]
  4157. }),
  4158. smalltalk.StringTest);
  4159. smalltalk.addMethod(
  4160. smalltalk.method({
  4161. selector: "testCapitalized",
  4162. protocol: 'tests',
  4163. fn: function (){
  4164. var self=this;
  4165. return smalltalk.withContext(function($ctx1) {
  4166. var $1,$2,$3;
  4167. $1="test"._capitalized();
  4168. $ctx1.sendIdx["capitalized"]=1;
  4169. self._assert_equals_($1,"Test");
  4170. $ctx1.sendIdx["assert:equals:"]=1;
  4171. $2="Test"._capitalized();
  4172. $ctx1.sendIdx["capitalized"]=2;
  4173. self._assert_equals_($2,"Test");
  4174. $ctx1.sendIdx["assert:equals:"]=2;
  4175. self._assert_equals_(""._capitalized(),"");
  4176. $ctx1.sendIdx["assert:equals:"]=3;
  4177. $3="Test"._isCapitalized();
  4178. $ctx1.sendIdx["isCapitalized"]=1;
  4179. self._assert_equals_($3,true);
  4180. $ctx1.sendIdx["assert:equals:"]=4;
  4181. self._assert_equals_("test"._isCapitalized(),false);
  4182. return self}, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},smalltalk.StringTest)})},
  4183. args: [],
  4184. 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.",
  4185. messageSends: ["assert:equals:", "capitalized", "isCapitalized"],
  4186. referencedClasses: []
  4187. }),
  4188. smalltalk.StringTest);
  4189. smalltalk.addMethod(
  4190. smalltalk.method({
  4191. selector: "testCharCodeAt",
  4192. protocol: 'tests',
  4193. fn: function (){
  4194. var self=this;
  4195. return smalltalk.withContext(function($ctx1) {
  4196. var $1,$2,$3,$4,$5;
  4197. $1="jackie"._charCodeAt_((1));
  4198. $ctx1.sendIdx["charCodeAt:"]=1;
  4199. self._assert_equals_($1,(106));
  4200. $ctx1.sendIdx["assert:equals:"]=1;
  4201. $2="jackie"._charCodeAt_((2));
  4202. $ctx1.sendIdx["charCodeAt:"]=2;
  4203. self._assert_equals_($2,(97));
  4204. $ctx1.sendIdx["assert:equals:"]=2;
  4205. $3="jackie"._charCodeAt_((3));
  4206. $ctx1.sendIdx["charCodeAt:"]=3;
  4207. self._assert_equals_($3,(99));
  4208. $ctx1.sendIdx["assert:equals:"]=3;
  4209. $4="jackie"._charCodeAt_((4));
  4210. $ctx1.sendIdx["charCodeAt:"]=4;
  4211. self._assert_equals_($4,(107));
  4212. $ctx1.sendIdx["assert:equals:"]=4;
  4213. $5="jackie"._charCodeAt_((5));
  4214. $ctx1.sendIdx["charCodeAt:"]=5;
  4215. self._assert_equals_($5,(105));
  4216. $ctx1.sendIdx["assert:equals:"]=5;
  4217. self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  4218. return self}, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},smalltalk.StringTest)})},
  4219. args: [],
  4220. 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",
  4221. messageSends: ["assert:equals:", "charCodeAt:"],
  4222. referencedClasses: []
  4223. }),
  4224. smalltalk.StringTest);
  4225. smalltalk.addMethod(
  4226. smalltalk.method({
  4227. selector: "testCollect",
  4228. protocol: 'tests',
  4229. fn: function (){
  4230. var self=this;
  4231. var newCollection;
  4232. return smalltalk.withContext(function($ctx1) {
  4233. newCollection="hheelllloo";
  4234. self._assertSameContents_as_(_st(self._collection())._collect_((function(each){
  4235. return smalltalk.withContext(function($ctx2) {
  4236. return _st(each).__comma(each);
  4237. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  4238. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{newCollection:newCollection},smalltalk.StringTest)})},
  4239. args: [],
  4240. source: "testCollect\x0a\x09| newCollection |\x0a\x09newCollection := 'hheelllloo'.\x0a\x09self\x0a\x09\x09assertSameContents: (self collection collect: [ :each |\x0a\x09\x09\x09each, each ])\x0a\x09\x09as: newCollection",
  4241. messageSends: ["assertSameContents:as:", "collect:", "collection", ","],
  4242. referencedClasses: []
  4243. }),
  4244. smalltalk.StringTest);
  4245. smalltalk.addMethod(
  4246. smalltalk.method({
  4247. selector: "testCopyFromTo",
  4248. protocol: 'tests',
  4249. fn: function (){
  4250. var self=this;
  4251. return smalltalk.withContext(function($ctx1) {
  4252. var $1;
  4253. $1="jackie"._copyFrom_to_((1),(3));
  4254. $ctx1.sendIdx["copyFrom:to:"]=1;
  4255. self._assert_equals_($1,"jac");
  4256. $ctx1.sendIdx["assert:equals:"]=1;
  4257. self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  4258. return self}, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},smalltalk.StringTest)})},
  4259. args: [],
  4260. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  4261. messageSends: ["assert:equals:", "copyFrom:to:"],
  4262. referencedClasses: []
  4263. }),
  4264. smalltalk.StringTest);
  4265. smalltalk.addMethod(
  4266. smalltalk.method({
  4267. selector: "testCopyWithoutAll",
  4268. protocol: 'tests',
  4269. fn: function (){
  4270. var self=this;
  4271. return smalltalk.withContext(function($ctx1) {
  4272. self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  4273. return self}, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},smalltalk.StringTest)})},
  4274. args: [],
  4275. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  4276. messageSends: ["assert:equals:", "copyWithoutAll:"],
  4277. referencedClasses: []
  4278. }),
  4279. smalltalk.StringTest);
  4280. smalltalk.addMethod(
  4281. smalltalk.method({
  4282. selector: "testDetect",
  4283. protocol: 'tests',
  4284. fn: function (){
  4285. var self=this;
  4286. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4287. return smalltalk.withContext(function($ctx1) {
  4288. var $2,$1;
  4289. $2=self._collection();
  4290. $ctx1.sendIdx["collection"]=1;
  4291. $1=_st($2)._detect_((function(each){
  4292. return smalltalk.withContext(function($ctx2) {
  4293. return _st(each).__eq("h");
  4294. $ctx2.sendIdx["="]=1;
  4295. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  4296. $ctx1.sendIdx["detect:"]=1;
  4297. self._assert_equals_($1,"h");
  4298. self._should_raise_((function(){
  4299. return smalltalk.withContext(function($ctx2) {
  4300. return _st(self._collection())._detect_((function(each){
  4301. return smalltalk.withContext(function($ctx3) {
  4302. return _st(each).__eq((6));
  4303. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,3)})}));
  4304. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  4305. return self}, function($ctx1) {$ctx1.fill(self,"testDetect",{},smalltalk.StringTest)})},
  4306. args: [],
  4307. source: "testDetect\x0a\x09self assert: (self collection detect: [ :each | each = 'h' ]) equals: 'h'.\x0a\x09self\x0a\x09\x09should: [ self collection detect: [ :each | each = 6 ] ]\x0a\x09\x09raise: Error",
  4308. messageSends: ["assert:equals:", "detect:", "collection", "=", "should:raise:"],
  4309. referencedClasses: ["Error"]
  4310. }),
  4311. smalltalk.StringTest);
  4312. smalltalk.addMethod(
  4313. smalltalk.method({
  4314. selector: "testEquality",
  4315. protocol: 'tests',
  4316. fn: function (){
  4317. var self=this;
  4318. return smalltalk.withContext(function($ctx1) {
  4319. var $1,$2,$3;
  4320. self._assert_equals_("hello","hello");
  4321. $ctx1.sendIdx["assert:equals:"]=1;
  4322. $1="hello".__eq("world");
  4323. $ctx1.sendIdx["="]=1;
  4324. self._deny_($1);
  4325. $ctx1.sendIdx["deny:"]=1;
  4326. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  4327. return smalltalk.withContext(function($ctx2) {
  4328. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})})));
  4329. $ctx1.sendIdx["="]=2;
  4330. self._deny_($2);
  4331. $ctx1.sendIdx["deny:"]=2;
  4332. $3="hello"._yourself();
  4333. $ctx1.sendIdx["yourself"]=1;
  4334. self._assert_equals_("hello",$3);
  4335. $ctx1.sendIdx["assert:equals:"]=2;
  4336. self._assert_equals_("hello"._yourself(),"hello");
  4337. self._deny_("".__eq((0)));
  4338. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.StringTest)})},
  4339. args: [],
  4340. 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",
  4341. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"],
  4342. referencedClasses: []
  4343. }),
  4344. smalltalk.StringTest);
  4345. smalltalk.addMethod(
  4346. smalltalk.method({
  4347. selector: "testIdentity",
  4348. protocol: 'tests',
  4349. fn: function (){
  4350. var self=this;
  4351. return smalltalk.withContext(function($ctx1) {
  4352. var $1,$2,$4,$3,$5;
  4353. $1="hello".__eq_eq("hello");
  4354. $ctx1.sendIdx["=="]=1;
  4355. self._assert_($1);
  4356. $ctx1.sendIdx["assert:"]=1;
  4357. $2="hello".__eq_eq("world");
  4358. $ctx1.sendIdx["=="]=2;
  4359. self._deny_($2);
  4360. $ctx1.sendIdx["deny:"]=1;
  4361. $4="hello"._yourself();
  4362. $ctx1.sendIdx["yourself"]=1;
  4363. $3="hello".__eq_eq($4);
  4364. $ctx1.sendIdx["=="]=3;
  4365. self._assert_($3);
  4366. $ctx1.sendIdx["assert:"]=2;
  4367. $5=_st("hello"._yourself()).__eq_eq("hello");
  4368. $ctx1.sendIdx["=="]=4;
  4369. self._assert_($5);
  4370. self._deny_("".__eq_eq((0)));
  4371. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.StringTest)})},
  4372. args: [],
  4373. 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",
  4374. messageSends: ["assert:", "==", "deny:", "yourself"],
  4375. referencedClasses: []
  4376. }),
  4377. smalltalk.StringTest);
  4378. smalltalk.addMethod(
  4379. smalltalk.method({
  4380. selector: "testIdentityHash",
  4381. protocol: 'tests',
  4382. fn: function (){
  4383. var self=this;
  4384. return smalltalk.withContext(function($ctx1) {
  4385. var $1,$2,$4,$3;
  4386. $1="foo"._identityHash();
  4387. $ctx1.sendIdx["identityHash"]=1;
  4388. $2="foo"._identityHash();
  4389. $ctx1.sendIdx["identityHash"]=2;
  4390. self._assert_equals_($1,$2);
  4391. $4="foo"._identityHash();
  4392. $ctx1.sendIdx["identityHash"]=3;
  4393. $3=_st($4).__eq("bar"._identityHash());
  4394. self._deny_($3);
  4395. return self}, function($ctx1) {$ctx1.fill(self,"testIdentityHash",{},smalltalk.StringTest)})},
  4396. args: [],
  4397. source: "testIdentityHash\x0a\x09self assert: 'foo' identityHash equals: 'foo' identityHash.\x0a\x09self deny: ('foo' identityHash = 'bar' identityHash)",
  4398. messageSends: ["assert:equals:", "identityHash", "deny:", "="],
  4399. referencedClasses: []
  4400. }),
  4401. smalltalk.StringTest);
  4402. smalltalk.addMethod(
  4403. smalltalk.method({
  4404. selector: "testIncludesSubString",
  4405. protocol: 'tests',
  4406. fn: function (){
  4407. var self=this;
  4408. return smalltalk.withContext(function($ctx1) {
  4409. var $1;
  4410. $1="amber"._includesSubString_("ber");
  4411. $ctx1.sendIdx["includesSubString:"]=1;
  4412. self._assert_($1);
  4413. self._deny_("amber"._includesSubString_("zork"));
  4414. return self}, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},smalltalk.StringTest)})},
  4415. args: [],
  4416. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  4417. messageSends: ["assert:", "includesSubString:", "deny:"],
  4418. referencedClasses: []
  4419. }),
  4420. smalltalk.StringTest);
  4421. smalltalk.addMethod(
  4422. smalltalk.method({
  4423. selector: "testIsVowel",
  4424. protocol: 'tests',
  4425. fn: function (){
  4426. var self=this;
  4427. var vowel,consonant;
  4428. return smalltalk.withContext(function($ctx1) {
  4429. var $1;
  4430. vowel="u";
  4431. consonant="z";
  4432. $1=_st(vowel)._isVowel();
  4433. $ctx1.sendIdx["isVowel"]=1;
  4434. self._assert_equals_($1,true);
  4435. $ctx1.sendIdx["assert:equals:"]=1;
  4436. self._assert_equals_(_st(consonant)._isVowel(),false);
  4437. return self}, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},smalltalk.StringTest)})},
  4438. args: [],
  4439. 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",
  4440. messageSends: ["assert:equals:", "isVowel"],
  4441. referencedClasses: []
  4442. }),
  4443. smalltalk.StringTest);
  4444. smalltalk.addMethod(
  4445. smalltalk.method({
  4446. selector: "testJoin",
  4447. protocol: 'tests',
  4448. fn: function (){
  4449. var self=this;
  4450. return smalltalk.withContext(function($ctx1) {
  4451. self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  4452. return self}, function($ctx1) {$ctx1.fill(self,"testJoin",{},smalltalk.StringTest)})},
  4453. args: [],
  4454. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  4455. messageSends: ["assert:equals:", "join:"],
  4456. referencedClasses: []
  4457. }),
  4458. smalltalk.StringTest);
  4459. smalltalk.addMethod(
  4460. smalltalk.method({
  4461. selector: "testRemoveAll",
  4462. protocol: 'tests',
  4463. fn: function (){
  4464. var self=this;
  4465. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4466. return smalltalk.withContext(function($ctx1) {
  4467. self._should_raise_((function(){
  4468. return smalltalk.withContext(function($ctx2) {
  4469. return _st(self._collection())._removeAll();
  4470. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4471. return self}, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},smalltalk.StringTest)})},
  4472. args: [],
  4473. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  4474. messageSends: ["should:raise:", "removeAll", "collection"],
  4475. referencedClasses: ["Error"]
  4476. }),
  4477. smalltalk.StringTest);
  4478. smalltalk.addMethod(
  4479. smalltalk.method({
  4480. selector: "testReversed",
  4481. protocol: 'tests',
  4482. fn: function (){
  4483. var self=this;
  4484. return smalltalk.withContext(function($ctx1) {
  4485. self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  4486. return self}, function($ctx1) {$ctx1.fill(self,"testReversed",{},smalltalk.StringTest)})},
  4487. args: [],
  4488. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  4489. messageSends: ["assert:equals:", "reversed"],
  4490. referencedClasses: []
  4491. }),
  4492. smalltalk.StringTest);
  4493. smalltalk.addMethod(
  4494. smalltalk.method({
  4495. selector: "testSelect",
  4496. protocol: 'tests',
  4497. fn: function (){
  4498. var self=this;
  4499. var newCollection;
  4500. return smalltalk.withContext(function($ctx1) {
  4501. newCollection="o";
  4502. self._assertSameContents_as_(_st(self._collection())._select_((function(each){
  4503. return smalltalk.withContext(function($ctx2) {
  4504. return _st(each).__eq("o");
  4505. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})})),newCollection);
  4506. return self}, function($ctx1) {$ctx1.fill(self,"testSelect",{newCollection:newCollection},smalltalk.StringTest)})},
  4507. args: [],
  4508. source: "testSelect\x0a\x09| newCollection |\x0a\x09newCollection := 'o'.\x0a\x09self\x0a\x09\x09assertSameContents: (self collection select: [ :each |\x0a\x09\x09\x09each = 'o' ])\x0a\x09\x09as: newCollection",
  4509. messageSends: ["assertSameContents:as:", "select:", "collection", "="],
  4510. referencedClasses: []
  4511. }),
  4512. smalltalk.StringTest);
  4513. smalltalk.addMethod(
  4514. smalltalk.method({
  4515. selector: "testStreamContents",
  4516. protocol: 'tests',
  4517. fn: function (){
  4518. var self=this;
  4519. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  4520. return smalltalk.withContext(function($ctx1) {
  4521. var $1;
  4522. self._assert_equals_(_st($String())._streamContents_((function(aStream){
  4523. return smalltalk.withContext(function($ctx2) {
  4524. _st(aStream)._nextPutAll_("hello");
  4525. $ctx2.sendIdx["nextPutAll:"]=1;
  4526. _st(aStream)._space();
  4527. $1=_st(aStream)._nextPutAll_("world");
  4528. return $1;
  4529. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)})})),"hello world");
  4530. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StringTest)})},
  4531. args: [],
  4532. 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'",
  4533. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"],
  4534. referencedClasses: ["String"]
  4535. }),
  4536. smalltalk.StringTest);
  4537. smalltalk.addMethod(
  4538. smalltalk.method({
  4539. selector: "testSubStrings",
  4540. protocol: 'tests',
  4541. fn: function (){
  4542. var self=this;
  4543. return smalltalk.withContext(function($ctx1) {
  4544. self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  4545. return self}, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},smalltalk.StringTest)})},
  4546. args: [],
  4547. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  4548. messageSends: ["assert:equals:", "subStrings:"],
  4549. referencedClasses: []
  4550. }),
  4551. smalltalk.StringTest);
  4552. smalltalk.addMethod(
  4553. smalltalk.method({
  4554. selector: "testTrim",
  4555. protocol: 'tests',
  4556. fn: function (){
  4557. var self=this;
  4558. return smalltalk.withContext(function($ctx1) {
  4559. self._assert_equals_(" jackie"._trimLeft(),"jackie");
  4560. $ctx1.sendIdx["assert:equals:"]=1;
  4561. self._assert_equals_("jackie "._trimRight(),"jackie");
  4562. return self}, function($ctx1) {$ctx1.fill(self,"testTrim",{},smalltalk.StringTest)})},
  4563. args: [],
  4564. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  4565. messageSends: ["assert:equals:", "trimLeft", "trimRight"],
  4566. referencedClasses: []
  4567. }),
  4568. smalltalk.StringTest);
  4569. smalltalk.addMethod(
  4570. smalltalk.method({
  4571. selector: "collectionClass",
  4572. protocol: 'fixture',
  4573. fn: function (){
  4574. var self=this;
  4575. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  4576. return smalltalk.withContext(function($ctx1) {
  4577. return $String();
  4578. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringTest.klass)})},
  4579. args: [],
  4580. source: "collectionClass\x0a\x09^ String",
  4581. messageSends: [],
  4582. referencedClasses: ["String"]
  4583. }),
  4584. smalltalk.StringTest.klass);
  4585. smalltalk.addClass('ConsoleTranscriptTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4586. smalltalk.addMethod(
  4587. smalltalk.method({
  4588. selector: "testShow",
  4589. protocol: 'tests',
  4590. fn: function (){
  4591. var self=this;
  4592. var originalTranscript;
  4593. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  4594. function $ConsoleTranscript(){return smalltalk.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
  4595. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4596. return smalltalk.withContext(function($ctx1) {
  4597. originalTranscript=_st($Transcript())._current();
  4598. _st($Transcript())._register_(_st($ConsoleTranscript())._new());
  4599. $ctx1.sendIdx["register:"]=1;
  4600. self._shouldnt_raise_((function(){
  4601. return smalltalk.withContext(function($ctx2) {
  4602. return _st($Transcript())._show_("Hello console!");
  4603. $ctx2.sendIdx["show:"]=1;
  4604. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  4605. $ctx1.sendIdx["shouldnt:raise:"]=1;
  4606. self._shouldnt_raise_((function(){
  4607. return smalltalk.withContext(function($ctx2) {
  4608. return _st($Transcript())._show_(console);
  4609. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$Error());
  4610. _st($Transcript())._register_(originalTranscript);
  4611. return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},smalltalk.ConsoleTranscriptTest)})},
  4612. args: [],
  4613. 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.",
  4614. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
  4615. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
  4616. }),
  4617. smalltalk.ConsoleTranscriptTest);
  4618. smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4619. smalltalk.addMethod(
  4620. smalltalk.method({
  4621. selector: "jsObject",
  4622. protocol: 'accessing',
  4623. fn: function (){
  4624. var self=this;
  4625. return smalltalk.withContext(function($ctx1) {
  4626. return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0};
  4627. return self}, function($ctx1) {$ctx1.fill(self,"jsObject",{},smalltalk.JSObjectProxyTest)})},
  4628. args: [],
  4629. source: "jsObject\x0a\x09<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: '', 'e': null, 'f': void 0}>",
  4630. messageSends: [],
  4631. referencedClasses: []
  4632. }),
  4633. smalltalk.JSObjectProxyTest);
  4634. smalltalk.addMethod(
  4635. smalltalk.method({
  4636. selector: "testAtIfAbsent",
  4637. protocol: 'tests',
  4638. fn: function (){
  4639. var self=this;
  4640. var testObject;
  4641. return smalltalk.withContext(function($ctx1) {
  4642. var $1,$2,$3;
  4643. testObject=self._jsObject();
  4644. $1=_st(testObject)._at_ifAbsent_("abc",(function(){
  4645. return smalltalk.withContext(function($ctx2) {
  4646. return "Property does not exist";
  4647. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  4648. $ctx1.sendIdx["at:ifAbsent:"]=1;
  4649. self._assert_equals_($1,"Property does not exist");
  4650. $ctx1.sendIdx["assert:equals:"]=1;
  4651. $2=_st(testObject)._at_ifAbsent_("e",(function(){
  4652. return smalltalk.withContext(function($ctx2) {
  4653. return "Property does not exist";
  4654. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  4655. $ctx1.sendIdx["at:ifAbsent:"]=2;
  4656. self._assert_equals_($2,nil);
  4657. $ctx1.sendIdx["assert:equals:"]=2;
  4658. $3=_st(testObject)._at_ifAbsent_("a",(function(){
  4659. return smalltalk.withContext(function($ctx2) {
  4660. return "Property does not exist";
  4661. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  4662. $ctx1.sendIdx["at:ifAbsent:"]=3;
  4663. self._assert_equals_($3,(1));
  4664. $ctx1.sendIdx["assert:equals:"]=3;
  4665. self._assert_equals_(_st(testObject)._at_ifAbsent_("f",(function(){
  4666. return smalltalk.withContext(function($ctx2) {
  4667. return "Property does not exist";
  4668. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})})),nil);
  4669. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  4670. args: [],
  4671. 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.",
  4672. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"],
  4673. referencedClasses: []
  4674. }),
  4675. smalltalk.JSObjectProxyTest);
  4676. smalltalk.addMethod(
  4677. smalltalk.method({
  4678. selector: "testAtIfPresent",
  4679. protocol: 'tests',
  4680. fn: function (){
  4681. var self=this;
  4682. var testObject;
  4683. return smalltalk.withContext(function($ctx1) {
  4684. var $2,$1,$4,$3,$6,$5;
  4685. testObject=self._jsObject();
  4686. $1=_st(testObject)._at_ifPresent_("abc",(function(x){
  4687. return smalltalk.withContext(function($ctx2) {
  4688. $2=_st(x)._asString();
  4689. $ctx2.sendIdx["asString"]=1;
  4690. return "hello ".__comma($2);
  4691. $ctx2.sendIdx[","]=1;
  4692. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  4693. $ctx1.sendIdx["at:ifPresent:"]=1;
  4694. self._assert_equals_($1,nil);
  4695. $ctx1.sendIdx["assert:equals:"]=1;
  4696. $3=_st(testObject)._at_ifPresent_("e",(function(x){
  4697. return smalltalk.withContext(function($ctx2) {
  4698. $4=_st(x)._asString();
  4699. $ctx2.sendIdx["asString"]=2;
  4700. return "hello ".__comma($4);
  4701. $ctx2.sendIdx[","]=2;
  4702. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)})}));
  4703. $ctx1.sendIdx["at:ifPresent:"]=2;
  4704. self._assert_equals_($3,"hello nil");
  4705. $ctx1.sendIdx["assert:equals:"]=2;
  4706. $5=_st(testObject)._at_ifPresent_("a",(function(x){
  4707. return smalltalk.withContext(function($ctx2) {
  4708. $6=_st(x)._asString();
  4709. $ctx2.sendIdx["asString"]=3;
  4710. return "hello ".__comma($6);
  4711. $ctx2.sendIdx[","]=3;
  4712. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}));
  4713. $ctx1.sendIdx["at:ifPresent:"]=3;
  4714. self._assert_equals_($5,"hello 1");
  4715. $ctx1.sendIdx["assert:equals:"]=3;
  4716. self._assert_equals_(_st(testObject)._at_ifPresent_("f",(function(x){
  4717. return smalltalk.withContext(function($ctx2) {
  4718. return "hello ".__comma(_st(x)._asString());
  4719. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)})})),"hello nil");
  4720. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  4721. args: [],
  4722. 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'.",
  4723. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"],
  4724. referencedClasses: []
  4725. }),
  4726. smalltalk.JSObjectProxyTest);
  4727. smalltalk.addMethod(
  4728. smalltalk.method({
  4729. selector: "testAtIfPresentIfAbsent",
  4730. protocol: 'tests',
  4731. fn: function (){
  4732. var self=this;
  4733. var testObject;
  4734. return smalltalk.withContext(function($ctx1) {
  4735. var $2,$1,$4,$3,$6,$5;
  4736. testObject=self._jsObject();
  4737. $1=_st(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  4738. return smalltalk.withContext(function($ctx2) {
  4739. $2=_st(x)._asString();
  4740. $ctx2.sendIdx["asString"]=1;
  4741. return "hello ".__comma($2);
  4742. $ctx2.sendIdx[","]=1;
  4743. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}),(function(){
  4744. return smalltalk.withContext(function($ctx2) {
  4745. return "not present";
  4746. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  4747. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  4748. self._assert_equals_($1,"not present");
  4749. $ctx1.sendIdx["assert:equals:"]=1;
  4750. $3=_st(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  4751. return smalltalk.withContext(function($ctx2) {
  4752. $4=_st(x)._asString();
  4753. $ctx2.sendIdx["asString"]=2;
  4754. return "hello ".__comma($4);
  4755. $ctx2.sendIdx[","]=2;
  4756. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)})}),(function(){
  4757. return smalltalk.withContext(function($ctx2) {
  4758. return "not present";
  4759. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  4760. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  4761. self._assert_equals_($3,"hello nil");
  4762. $ctx1.sendIdx["assert:equals:"]=2;
  4763. $5=_st(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  4764. return smalltalk.withContext(function($ctx2) {
  4765. $6=_st(x)._asString();
  4766. $ctx2.sendIdx["asString"]=3;
  4767. return "hello ".__comma($6);
  4768. $ctx2.sendIdx[","]=3;
  4769. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)})}),(function(){
  4770. return smalltalk.withContext(function($ctx2) {
  4771. return "not present";
  4772. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  4773. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  4774. self._assert_equals_($5,"hello 1");
  4775. $ctx1.sendIdx["assert:equals:"]=3;
  4776. self._assert_equals_(_st(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  4777. return smalltalk.withContext(function($ctx2) {
  4778. return "hello ".__comma(_st(x)._asString());
  4779. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)})}),(function(){
  4780. return smalltalk.withContext(function($ctx2) {
  4781. return "not present";
  4782. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})})),"hello nil");
  4783. return self}, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  4784. args: [],
  4785. 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'.",
  4786. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"],
  4787. referencedClasses: []
  4788. }),
  4789. smalltalk.JSObjectProxyTest);
  4790. smalltalk.addMethod(
  4791. smalltalk.method({
  4792. selector: "testAtPut",
  4793. protocol: 'tests',
  4794. fn: function (){
  4795. var self=this;
  4796. var testObject;
  4797. return smalltalk.withContext(function($ctx1) {
  4798. var $2,$1;
  4799. testObject=self._jsObject();
  4800. $2=_st(testObject)._at_("abc");
  4801. $ctx1.sendIdx["at:"]=1;
  4802. $1=_st($2).__tild_eq("xyz");
  4803. self._assert_($1);
  4804. self._assert_equals_(_st(testObject)._at_put_("abc","xyz"),"xyz");
  4805. $ctx1.sendIdx["assert:equals:"]=1;
  4806. self._assert_equals_(_st(testObject)._at_("abc"),"xyz");
  4807. return self}, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  4808. args: [],
  4809. 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'",
  4810. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"],
  4811. referencedClasses: []
  4812. }),
  4813. smalltalk.JSObjectProxyTest);
  4814. smalltalk.addMethod(
  4815. smalltalk.method({
  4816. selector: "testDNU",
  4817. protocol: 'tests',
  4818. fn: function (){
  4819. var self=this;
  4820. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4821. return smalltalk.withContext(function($ctx1) {
  4822. self._should_raise_((function(){
  4823. return smalltalk.withContext(function($ctx2) {
  4824. return _st(self._jsObject())._foo();
  4825. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4826. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.JSObjectProxyTest)})},
  4827. args: [],
  4828. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  4829. messageSends: ["should:raise:", "foo", "jsObject"],
  4830. referencedClasses: ["MessageNotUnderstood"]
  4831. }),
  4832. smalltalk.JSObjectProxyTest);
  4833. smalltalk.addMethod(
  4834. smalltalk.method({
  4835. selector: "testMessageSend",
  4836. protocol: 'tests',
  4837. fn: function (){
  4838. var self=this;
  4839. return smalltalk.withContext(function($ctx1) {
  4840. var $2,$1,$4,$3;
  4841. $2=self._jsObject();
  4842. $ctx1.sendIdx["jsObject"]=1;
  4843. $1=_st($2)._a();
  4844. self._assert_equals_($1,(1));
  4845. $ctx1.sendIdx["assert:equals:"]=1;
  4846. $4=self._jsObject();
  4847. $ctx1.sendIdx["jsObject"]=2;
  4848. $3=_st($4)._b();
  4849. self._assert_equals_($3,(2));
  4850. $ctx1.sendIdx["assert:equals:"]=2;
  4851. self._assert_equals_(_st(self._jsObject())._c_((3)),(3));
  4852. return self}, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},smalltalk.JSObjectProxyTest)})},
  4853. args: [],
  4854. 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",
  4855. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"],
  4856. referencedClasses: []
  4857. }),
  4858. smalltalk.JSObjectProxyTest);
  4859. smalltalk.addMethod(
  4860. smalltalk.method({
  4861. selector: "testMethodWithArguments",
  4862. protocol: 'tests',
  4863. fn: function (){
  4864. var self=this;
  4865. return smalltalk.withContext(function($ctx1) {
  4866. self._assert_equals_(_st(self._jsObject())._c_((1)),(1));
  4867. return self}, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},smalltalk.JSObjectProxyTest)})},
  4868. args: [],
  4869. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  4870. messageSends: ["assert:equals:", "c:", "jsObject"],
  4871. referencedClasses: []
  4872. }),
  4873. smalltalk.JSObjectProxyTest);
  4874. smalltalk.addMethod(
  4875. smalltalk.method({
  4876. selector: "testPrinting",
  4877. protocol: 'tests',
  4878. fn: function (){
  4879. var self=this;
  4880. return smalltalk.withContext(function($ctx1) {
  4881. self._assert_equals_(_st(self._jsObject())._printString(),"[object Object]");
  4882. return self}, function($ctx1) {$ctx1.fill(self,"testPrinting",{},smalltalk.JSObjectProxyTest)})},
  4883. args: [],
  4884. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  4885. messageSends: ["assert:equals:", "printString", "jsObject"],
  4886. referencedClasses: []
  4887. }),
  4888. smalltalk.JSObjectProxyTest);
  4889. smalltalk.addMethod(
  4890. smalltalk.method({
  4891. selector: "testPropertyThatReturnsEmptyString",
  4892. protocol: 'tests',
  4893. fn: function (){
  4894. var self=this;
  4895. var object;
  4896. return smalltalk.withContext(function($ctx1) {
  4897. var $1;
  4898. object=self._jsObject();
  4899. $1=_st(object)._d();
  4900. $ctx1.sendIdx["d"]=1;
  4901. self._assert_equals_($1,"");
  4902. $ctx1.sendIdx["assert:equals:"]=1;
  4903. _st(object)._d_("hello");
  4904. self._assert_equals_(_st(object)._d(),"hello");
  4905. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},smalltalk.JSObjectProxyTest)})},
  4906. args: [],
  4907. 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'",
  4908. messageSends: ["jsObject", "assert:equals:", "d", "d:"],
  4909. referencedClasses: []
  4910. }),
  4911. smalltalk.JSObjectProxyTest);
  4912. smalltalk.addMethod(
  4913. smalltalk.method({
  4914. selector: "testPropertyThatReturnsUndefined",
  4915. protocol: 'tests',
  4916. fn: function (){
  4917. var self=this;
  4918. var object;
  4919. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  4920. return smalltalk.withContext(function($ctx1) {
  4921. object=self._jsObject();
  4922. self._shouldnt_raise_((function(){
  4923. return smalltalk.withContext(function($ctx2) {
  4924. return _st(object)._e();
  4925. $ctx2.sendIdx["e"]=1;
  4926. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  4927. self._assert_(_st(_st(object)._e())._isNil());
  4928. return self}, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},smalltalk.JSObjectProxyTest)})},
  4929. args: [],
  4930. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  4931. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"],
  4932. referencedClasses: ["MessageNotUnderstood"]
  4933. }),
  4934. smalltalk.JSObjectProxyTest);
  4935. smalltalk.addMethod(
  4936. smalltalk.method({
  4937. selector: "testValue",
  4938. protocol: 'tests',
  4939. fn: function (){
  4940. var self=this;
  4941. var testObject;
  4942. return smalltalk.withContext(function($ctx1) {
  4943. testObject=self._jsObject();
  4944. _st(testObject)._at_put_("value","aValue");
  4945. self._assert_equals_(_st(testObject)._value(),"aValue");
  4946. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},smalltalk.JSObjectProxyTest)})},
  4947. args: [],
  4948. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  4949. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"],
  4950. referencedClasses: []
  4951. }),
  4952. smalltalk.JSObjectProxyTest);
  4953. smalltalk.addMethod(
  4954. smalltalk.method({
  4955. selector: "testYourself",
  4956. protocol: 'tests',
  4957. fn: function (){
  4958. var self=this;
  4959. var object;
  4960. return smalltalk.withContext(function($ctx1) {
  4961. var $1,$2;
  4962. $1=self._jsObject();
  4963. _st($1)._d_("test");
  4964. $2=_st($1)._yourself();
  4965. object=$2;
  4966. self._assert_equals_(_st(object)._d(),"test");
  4967. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},smalltalk.JSObjectProxyTest)})},
  4968. args: [],
  4969. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  4970. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"],
  4971. referencedClasses: []
  4972. }),
  4973. smalltalk.JSObjectProxyTest);
  4974. smalltalk.addClass('JavaScriptExceptionTest', smalltalk.TestCase, [], 'Kernel-Tests');
  4975. smalltalk.addMethod(
  4976. smalltalk.method({
  4977. selector: "testCatchingException",
  4978. protocol: 'tests',
  4979. fn: function (){
  4980. var self=this;
  4981. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  4982. return smalltalk.withContext(function($ctx1) {
  4983. _st((function(){
  4984. return smalltalk.withContext(function($ctx2) {
  4985. return self._throwException();
  4986. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(error){
  4987. return smalltalk.withContext(function($ctx2) {
  4988. return self._assert_(_st(_st(error)._exception()).__eq("test"));
  4989. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  4990. return self}, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},smalltalk.JavaScriptExceptionTest)})},
  4991. args: [],
  4992. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  4993. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"],
  4994. referencedClasses: ["Error"]
  4995. }),
  4996. smalltalk.JavaScriptExceptionTest);
  4997. smalltalk.addMethod(
  4998. smalltalk.method({
  4999. selector: "testRaisingException",
  5000. protocol: 'tests',
  5001. fn: function (){
  5002. var self=this;
  5003. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  5004. return smalltalk.withContext(function($ctx1) {
  5005. self._should_raise_((function(){
  5006. return smalltalk.withContext(function($ctx2) {
  5007. return self._throwException();
  5008. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$JavaScriptException());
  5009. return self}, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},smalltalk.JavaScriptExceptionTest)})},
  5010. args: [],
  5011. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  5012. messageSends: ["should:raise:", "throwException"],
  5013. referencedClasses: ["JavaScriptException"]
  5014. }),
  5015. smalltalk.JavaScriptExceptionTest);
  5016. smalltalk.addMethod(
  5017. smalltalk.method({
  5018. selector: "throwException",
  5019. protocol: 'helpers',
  5020. fn: function (){
  5021. var self=this;
  5022. return smalltalk.withContext(function($ctx1) {
  5023. throw 'test';
  5024. return self}, function($ctx1) {$ctx1.fill(self,"throwException",{},smalltalk.JavaScriptExceptionTest)})},
  5025. args: [],
  5026. source: "throwException\x0a\x09<throw 'test'>",
  5027. messageSends: [],
  5028. referencedClasses: []
  5029. }),
  5030. smalltalk.JavaScriptExceptionTest);
  5031. smalltalk.addClass('MessageSendTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5032. smalltalk.addMethod(
  5033. smalltalk.method({
  5034. selector: "testValue",
  5035. protocol: 'tests',
  5036. fn: function (){
  5037. var self=this;
  5038. var messageSend;
  5039. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  5040. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5041. return smalltalk.withContext(function($ctx1) {
  5042. var $1,$2;
  5043. $1=_st($MessageSend())._new();
  5044. $ctx1.sendIdx["new"]=1;
  5045. _st($1)._receiver_(_st($Object())._new());
  5046. _st($1)._selector_("asString");
  5047. $2=_st($1)._yourself();
  5048. messageSend=$2;
  5049. self._assert_equals_(_st(messageSend)._value(),"an Object");
  5050. return self}, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  5051. args: [],
  5052. 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'",
  5053. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"],
  5054. referencedClasses: ["MessageSend", "Object"]
  5055. }),
  5056. smalltalk.MessageSendTest);
  5057. smalltalk.addMethod(
  5058. smalltalk.method({
  5059. selector: "testValueWithArguments",
  5060. protocol: 'tests',
  5061. fn: function (){
  5062. var self=this;
  5063. var messageSend;
  5064. function $MessageSend(){return smalltalk.MessageSend||(typeof MessageSend=="undefined"?nil:MessageSend)}
  5065. return smalltalk.withContext(function($ctx1) {
  5066. var $1,$2;
  5067. $1=_st($MessageSend())._new();
  5068. _st($1)._receiver_((2));
  5069. _st($1)._selector_("+");
  5070. $2=_st($1)._yourself();
  5071. messageSend=$2;
  5072. self._assert_equals_(_st(messageSend)._value_((3)),(5));
  5073. $ctx1.sendIdx["assert:equals:"]=1;
  5074. self._assert_equals_(_st(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  5075. return self}, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},smalltalk.MessageSendTest)})},
  5076. args: [],
  5077. 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",
  5078. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"],
  5079. referencedClasses: ["MessageSend"]
  5080. }),
  5081. smalltalk.MessageSendTest);
  5082. smalltalk.addClass('MethodInheritanceTest', smalltalk.TestCase, ['receiverTop', 'receiverMiddle', 'receiverBottom', 'method', 'performBlock'], 'Kernel-Tests');
  5083. smalltalk.addMethod(
  5084. smalltalk.method({
  5085. selector: "codeGeneratorClass",
  5086. protocol: 'accessing',
  5087. fn: function (){
  5088. var self=this;
  5089. function $CodeGenerator(){return smalltalk.CodeGenerator||(typeof CodeGenerator=="undefined"?nil:CodeGenerator)}
  5090. return smalltalk.withContext(function($ctx1) {
  5091. return $CodeGenerator();
  5092. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},smalltalk.MethodInheritanceTest)})},
  5093. args: [],
  5094. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  5095. messageSends: [],
  5096. referencedClasses: ["CodeGenerator"]
  5097. }),
  5098. smalltalk.MethodInheritanceTest);
  5099. smalltalk.addMethod(
  5100. smalltalk.method({
  5101. selector: "compiler",
  5102. protocol: 'factory',
  5103. fn: function (){
  5104. var self=this;
  5105. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  5106. return smalltalk.withContext(function($ctx1) {
  5107. var $2,$3,$1;
  5108. $2=_st($Compiler())._new();
  5109. _st($2)._codeGeneratorClass_(self._codeGeneratorClass());
  5110. $3=_st($2)._yourself();
  5111. $1=$3;
  5112. return $1;
  5113. }, function($ctx1) {$ctx1.fill(self,"compiler",{},smalltalk.MethodInheritanceTest)})},
  5114. args: [],
  5115. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  5116. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"],
  5117. referencedClasses: ["Compiler"]
  5118. }),
  5119. smalltalk.MethodInheritanceTest);
  5120. smalltalk.addMethod(
  5121. smalltalk.method({
  5122. selector: "deinstallBottom",
  5123. protocol: 'testing',
  5124. fn: function (){
  5125. var self=this;
  5126. return smalltalk.withContext(function($ctx1) {
  5127. _st(self._targetClassBottom())._removeCompiledMethod_(self["@method"]);
  5128. return self}, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},smalltalk.MethodInheritanceTest)})},
  5129. args: [],
  5130. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  5131. messageSends: ["removeCompiledMethod:", "targetClassBottom"],
  5132. referencedClasses: []
  5133. }),
  5134. smalltalk.MethodInheritanceTest);
  5135. smalltalk.addMethod(
  5136. smalltalk.method({
  5137. selector: "deinstallMiddle",
  5138. protocol: 'testing',
  5139. fn: function (){
  5140. var self=this;
  5141. return smalltalk.withContext(function($ctx1) {
  5142. _st(self._targetClassMiddle())._removeCompiledMethod_(self["@method"]);
  5143. return self}, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},smalltalk.MethodInheritanceTest)})},
  5144. args: [],
  5145. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  5146. messageSends: ["removeCompiledMethod:", "targetClassMiddle"],
  5147. referencedClasses: []
  5148. }),
  5149. smalltalk.MethodInheritanceTest);
  5150. smalltalk.addMethod(
  5151. smalltalk.method({
  5152. selector: "deinstallTop",
  5153. protocol: 'testing',
  5154. fn: function (){
  5155. var self=this;
  5156. return smalltalk.withContext(function($ctx1) {
  5157. _st(self._targetClassTop())._removeCompiledMethod_(self["@method"]);
  5158. return self}, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},smalltalk.MethodInheritanceTest)})},
  5159. args: [],
  5160. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  5161. messageSends: ["removeCompiledMethod:", "targetClassTop"],
  5162. referencedClasses: []
  5163. }),
  5164. smalltalk.MethodInheritanceTest);
  5165. smalltalk.addMethod(
  5166. smalltalk.method({
  5167. selector: "installBottom:",
  5168. protocol: 'testing',
  5169. fn: function (aString){
  5170. var self=this;
  5171. return smalltalk.withContext(function($ctx1) {
  5172. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassBottom(),"tests");
  5173. return self}, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  5174. args: ["aString"],
  5175. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  5176. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"],
  5177. referencedClasses: []
  5178. }),
  5179. smalltalk.MethodInheritanceTest);
  5180. smalltalk.addMethod(
  5181. smalltalk.method({
  5182. selector: "installMiddle:",
  5183. protocol: 'testing',
  5184. fn: function (aString){
  5185. var self=this;
  5186. return smalltalk.withContext(function($ctx1) {
  5187. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassMiddle(),"tests");
  5188. return self}, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  5189. args: ["aString"],
  5190. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  5191. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"],
  5192. referencedClasses: []
  5193. }),
  5194. smalltalk.MethodInheritanceTest);
  5195. smalltalk.addMethod(
  5196. smalltalk.method({
  5197. selector: "installTop:",
  5198. protocol: 'testing',
  5199. fn: function (aString){
  5200. var self=this;
  5201. return smalltalk.withContext(function($ctx1) {
  5202. self["@method"]=_st(self._compiler())._install_forClass_protocol_(aString,self._targetClassTop(),"tests");
  5203. return self}, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},smalltalk.MethodInheritanceTest)})},
  5204. args: ["aString"],
  5205. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  5206. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"],
  5207. referencedClasses: []
  5208. }),
  5209. smalltalk.MethodInheritanceTest);
  5210. smalltalk.addMethod(
  5211. smalltalk.method({
  5212. selector: "setUp",
  5213. protocol: 'initialization',
  5214. fn: function (){
  5215. var self=this;
  5216. return smalltalk.withContext(function($ctx1) {
  5217. self["@receiverTop"]=_st(self._targetClassTop())._new();
  5218. $ctx1.sendIdx["new"]=1;
  5219. self["@receiverMiddle"]=_st(self._targetClassMiddle())._new();
  5220. $ctx1.sendIdx["new"]=2;
  5221. self["@receiverBottom"]=_st(self._targetClassBottom())._new();
  5222. self["@method"]=nil;
  5223. self["@performBlock"]=(function(){
  5224. return smalltalk.withContext(function($ctx2) {
  5225. return self._error_("performBlock not initialized");
  5226. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})});
  5227. return self}, function($ctx1) {$ctx1.fill(self,"setUp",{},smalltalk.MethodInheritanceTest)})},
  5228. args: [],
  5229. 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' ]",
  5230. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"],
  5231. referencedClasses: []
  5232. }),
  5233. smalltalk.MethodInheritanceTest);
  5234. smalltalk.addMethod(
  5235. smalltalk.method({
  5236. selector: "shouldMNU",
  5237. protocol: 'testing',
  5238. fn: function (){
  5239. var self=this;
  5240. return smalltalk.withContext(function($ctx1) {
  5241. self._shouldMNUTop();
  5242. self._shouldMNUMiddle();
  5243. self._shouldMNUBottom();
  5244. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},smalltalk.MethodInheritanceTest)})},
  5245. args: [],
  5246. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  5247. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"],
  5248. referencedClasses: []
  5249. }),
  5250. smalltalk.MethodInheritanceTest);
  5251. smalltalk.addMethod(
  5252. smalltalk.method({
  5253. selector: "shouldMNUBottom",
  5254. protocol: 'testing',
  5255. fn: function (){
  5256. var self=this;
  5257. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5258. return smalltalk.withContext(function($ctx1) {
  5259. self._should_raise_((function(){
  5260. return smalltalk.withContext(function($ctx2) {
  5261. return _st(self["@performBlock"])._value_(self["@receiverBottom"]);
  5262. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5263. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},smalltalk.MethodInheritanceTest)})},
  5264. args: [],
  5265. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  5266. messageSends: ["should:raise:", "value:"],
  5267. referencedClasses: ["MessageNotUnderstood"]
  5268. }),
  5269. smalltalk.MethodInheritanceTest);
  5270. smalltalk.addMethod(
  5271. smalltalk.method({
  5272. selector: "shouldMNUMiddle",
  5273. protocol: 'testing',
  5274. fn: function (){
  5275. var self=this;
  5276. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5277. return smalltalk.withContext(function($ctx1) {
  5278. self._should_raise_((function(){
  5279. return smalltalk.withContext(function($ctx2) {
  5280. return _st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  5281. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5282. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},smalltalk.MethodInheritanceTest)})},
  5283. args: [],
  5284. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  5285. messageSends: ["should:raise:", "value:"],
  5286. referencedClasses: ["MessageNotUnderstood"]
  5287. }),
  5288. smalltalk.MethodInheritanceTest);
  5289. smalltalk.addMethod(
  5290. smalltalk.method({
  5291. selector: "shouldMNUTop",
  5292. protocol: 'testing',
  5293. fn: function (){
  5294. var self=this;
  5295. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5296. return smalltalk.withContext(function($ctx1) {
  5297. self._should_raise_((function(){
  5298. return smalltalk.withContext(function($ctx2) {
  5299. return _st(self["@performBlock"])._value_(self["@receiverTop"]);
  5300. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5301. return self}, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},smalltalk.MethodInheritanceTest)})},
  5302. args: [],
  5303. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  5304. messageSends: ["should:raise:", "value:"],
  5305. referencedClasses: ["MessageNotUnderstood"]
  5306. }),
  5307. smalltalk.MethodInheritanceTest);
  5308. smalltalk.addMethod(
  5309. smalltalk.method({
  5310. selector: "shouldReturn:",
  5311. protocol: 'testing',
  5312. fn: function (anObject){
  5313. var self=this;
  5314. var result;
  5315. return smalltalk.withContext(function($ctx1) {
  5316. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  5317. $ctx1.sendIdx["value:"]=1;
  5318. self._assert_equals_(["top",anObject],["top",result]);
  5319. $ctx1.sendIdx["assert:equals:"]=1;
  5320. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  5321. $ctx1.sendIdx["value:"]=2;
  5322. self._assert_equals_(["middle",anObject],["middle",result]);
  5323. $ctx1.sendIdx["assert:equals:"]=2;
  5324. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  5325. self._assert_equals_(["bottom",anObject],["bottom",result]);
  5326. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},smalltalk.MethodInheritanceTest)})},
  5327. args: ["anObject"],
  5328. 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 }",
  5329. messageSends: ["value:", "assert:equals:"],
  5330. referencedClasses: []
  5331. }),
  5332. smalltalk.MethodInheritanceTest);
  5333. smalltalk.addMethod(
  5334. smalltalk.method({
  5335. selector: "shouldReturn:and:and:",
  5336. protocol: 'testing',
  5337. fn: function (anObject,anObject2,anObject3){
  5338. var self=this;
  5339. var result;
  5340. return smalltalk.withContext(function($ctx1) {
  5341. result=_st(self["@performBlock"])._value_(self["@receiverTop"]);
  5342. $ctx1.sendIdx["value:"]=1;
  5343. self._assert_equals_(["top",anObject],["top",result]);
  5344. $ctx1.sendIdx["assert:equals:"]=1;
  5345. result=_st(self["@performBlock"])._value_(self["@receiverMiddle"]);
  5346. $ctx1.sendIdx["value:"]=2;
  5347. self._assert_equals_(["middle",anObject2],["middle",result]);
  5348. $ctx1.sendIdx["assert:equals:"]=2;
  5349. result=_st(self["@performBlock"])._value_(self["@receiverBottom"]);
  5350. self._assert_equals_(["bottom",anObject3],["bottom",result]);
  5351. return self}, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},smalltalk.MethodInheritanceTest)})},
  5352. args: ["anObject", "anObject2", "anObject3"],
  5353. 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 }",
  5354. messageSends: ["value:", "assert:equals:"],
  5355. referencedClasses: []
  5356. }),
  5357. smalltalk.MethodInheritanceTest);
  5358. smalltalk.addMethod(
  5359. smalltalk.method({
  5360. selector: "targetClassBottom",
  5361. protocol: 'accessing',
  5362. fn: function (){
  5363. var self=this;
  5364. function $JavaScriptException(){return smalltalk.JavaScriptException||(typeof JavaScriptException=="undefined"?nil:JavaScriptException)}
  5365. return smalltalk.withContext(function($ctx1) {
  5366. return $JavaScriptException();
  5367. }, function($ctx1) {$ctx1.fill(self,"targetClassBottom",{},smalltalk.MethodInheritanceTest)})},
  5368. args: [],
  5369. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  5370. messageSends: [],
  5371. referencedClasses: ["JavaScriptException"]
  5372. }),
  5373. smalltalk.MethodInheritanceTest);
  5374. smalltalk.addMethod(
  5375. smalltalk.method({
  5376. selector: "targetClassMiddle",
  5377. protocol: 'accessing',
  5378. fn: function (){
  5379. var self=this;
  5380. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5381. return smalltalk.withContext(function($ctx1) {
  5382. return $Error();
  5383. }, function($ctx1) {$ctx1.fill(self,"targetClassMiddle",{},smalltalk.MethodInheritanceTest)})},
  5384. args: [],
  5385. source: "targetClassMiddle\x0a\x09^ Error",
  5386. messageSends: [],
  5387. referencedClasses: ["Error"]
  5388. }),
  5389. smalltalk.MethodInheritanceTest);
  5390. smalltalk.addMethod(
  5391. smalltalk.method({
  5392. selector: "targetClassTop",
  5393. protocol: 'accessing',
  5394. fn: function (){
  5395. var self=this;
  5396. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  5397. return smalltalk.withContext(function($ctx1) {
  5398. return $Object();
  5399. }, function($ctx1) {$ctx1.fill(self,"targetClassTop",{},smalltalk.MethodInheritanceTest)})},
  5400. args: [],
  5401. source: "targetClassTop\x0a\x09^ Object",
  5402. messageSends: [],
  5403. referencedClasses: ["Object"]
  5404. }),
  5405. smalltalk.MethodInheritanceTest);
  5406. smalltalk.addMethod(
  5407. smalltalk.method({
  5408. selector: "tearDown",
  5409. protocol: 'initialization',
  5410. fn: function (){
  5411. var self=this;
  5412. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  5413. return smalltalk.withContext(function($ctx1) {
  5414. _st((function(){
  5415. return smalltalk.withContext(function($ctx2) {
  5416. return self._deinstallTop();
  5417. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}))._on_do_($Error(),(function(){
  5418. return smalltalk.withContext(function($ctx2) {
  5419. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  5420. $ctx1.sendIdx["on:do:"]=1;
  5421. _st((function(){
  5422. return smalltalk.withContext(function($ctx2) {
  5423. return self._deinstallMiddle();
  5424. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}))._on_do_($Error(),(function(){
  5425. return smalltalk.withContext(function($ctx2) {
  5426. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}));
  5427. $ctx1.sendIdx["on:do:"]=2;
  5428. _st((function(){
  5429. return smalltalk.withContext(function($ctx2) {
  5430. return self._deinstallBottom();
  5431. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}))._on_do_($Error(),(function(){
  5432. return smalltalk.withContext(function($ctx2) {
  5433. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}));
  5434. return self}, function($ctx1) {$ctx1.fill(self,"tearDown",{},smalltalk.MethodInheritanceTest)})},
  5435. args: [],
  5436. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  5437. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"],
  5438. referencedClasses: ["Error"]
  5439. }),
  5440. smalltalk.MethodInheritanceTest);
  5441. smalltalk.addMethod(
  5442. smalltalk.method({
  5443. selector: "testMNU11",
  5444. protocol: 'tests',
  5445. fn: function (){
  5446. var self=this;
  5447. return smalltalk.withContext(function($ctx1) {
  5448. self["@performBlock"]=(function(x){
  5449. return smalltalk.withContext(function($ctx2) {
  5450. return _st(x)._foo();
  5451. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  5452. self._shouldMNU();
  5453. $ctx1.sendIdx["shouldMNU"]=1;
  5454. self._installTop_("foo ^ false");
  5455. $ctx1.sendIdx["installTop:"]=1;
  5456. self._installTop_("foo ^ true");
  5457. self._deinstallTop();
  5458. self._shouldMNU();
  5459. return self}, function($ctx1) {$ctx1.fill(self,"testMNU11",{},smalltalk.MethodInheritanceTest)})},
  5460. args: [],
  5461. 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",
  5462. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"],
  5463. referencedClasses: []
  5464. }),
  5465. smalltalk.MethodInheritanceTest);
  5466. smalltalk.addMethod(
  5467. smalltalk.method({
  5468. selector: "testMNU22",
  5469. protocol: 'tests',
  5470. fn: function (){
  5471. var self=this;
  5472. return smalltalk.withContext(function($ctx1) {
  5473. self["@performBlock"]=(function(x){
  5474. return smalltalk.withContext(function($ctx2) {
  5475. return _st(x)._foo();
  5476. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  5477. self._shouldMNU();
  5478. $ctx1.sendIdx["shouldMNU"]=1;
  5479. self._installMiddle_("foo ^ false");
  5480. $ctx1.sendIdx["installMiddle:"]=1;
  5481. self._installMiddle_("foo ^ true");
  5482. self._deinstallMiddle();
  5483. self._shouldMNU();
  5484. return self}, function($ctx1) {$ctx1.fill(self,"testMNU22",{},smalltalk.MethodInheritanceTest)})},
  5485. args: [],
  5486. 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",
  5487. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"],
  5488. referencedClasses: []
  5489. }),
  5490. smalltalk.MethodInheritanceTest);
  5491. smalltalk.addMethod(
  5492. smalltalk.method({
  5493. selector: "testReturns1",
  5494. protocol: 'tests',
  5495. fn: function (){
  5496. var self=this;
  5497. return smalltalk.withContext(function($ctx1) {
  5498. self["@performBlock"]=(function(x){
  5499. return smalltalk.withContext(function($ctx2) {
  5500. return _st(x)._foo();
  5501. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})});
  5502. self._installTop_("foo ^ false");
  5503. $ctx1.sendIdx["installTop:"]=1;
  5504. self._shouldReturn_(false);
  5505. $ctx1.sendIdx["shouldReturn:"]=1;
  5506. self._installTop_("foo ^ true");
  5507. self._shouldReturn_(true);
  5508. return self}, function($ctx1) {$ctx1.fill(self,"testReturns1",{},smalltalk.MethodInheritanceTest)})},
  5509. args: [],
  5510. 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",
  5511. messageSends: ["foo", "installTop:", "shouldReturn:"],
  5512. referencedClasses: []
  5513. }),
  5514. smalltalk.MethodInheritanceTest);
  5515. smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
  5516. smalltalk.addMethod(
  5517. smalltalk.method({
  5518. selector: "testAbs",
  5519. protocol: 'tests',
  5520. fn: function (){
  5521. var self=this;
  5522. return smalltalk.withContext(function($ctx1) {
  5523. var $1;
  5524. $1=(4)._abs();
  5525. $ctx1.sendIdx["abs"]=1;
  5526. self._assert_equals_($1,(4));
  5527. $ctx1.sendIdx["assert:equals:"]=1;
  5528. self._assert_equals_((-4)._abs(),(4));
  5529. return self}, function($ctx1) {$ctx1.fill(self,"testAbs",{},smalltalk.NumberTest)})},
  5530. args: [],
  5531. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  5532. messageSends: ["assert:equals:", "abs"],
  5533. referencedClasses: []
  5534. }),
  5535. smalltalk.NumberTest);
  5536. smalltalk.addMethod(
  5537. smalltalk.method({
  5538. selector: "testArithmetic",
  5539. protocol: 'tests',
  5540. fn: function (){
  5541. var self=this;
  5542. return smalltalk.withContext(function($ctx1) {
  5543. var $1,$2,$3,$5,$4;
  5544. $1=(1.5).__plus((1));
  5545. $ctx1.sendIdx["+"]=1;
  5546. self._assert_equals_($1,(2.5));
  5547. $ctx1.sendIdx["assert:equals:"]=1;
  5548. $2=(2).__minus((1));
  5549. $ctx1.sendIdx["-"]=1;
  5550. self._assert_equals_($2,(1));
  5551. $ctx1.sendIdx["assert:equals:"]=2;
  5552. self._assert_equals_((-2).__minus((1)),(-3));
  5553. $ctx1.sendIdx["assert:equals:"]=3;
  5554. self._assert_equals_((12).__slash((2)),(6));
  5555. $ctx1.sendIdx["assert:equals:"]=4;
  5556. $3=(3).__star((4));
  5557. $ctx1.sendIdx["*"]=1;
  5558. self._assert_equals_($3,(12));
  5559. $ctx1.sendIdx["assert:equals:"]=5;
  5560. self._assert_equals_((7).__slash_slash((2)),(3));
  5561. $ctx1.sendIdx["assert:equals:"]=6;
  5562. self._assert_equals_((7).__backslash_backslash((2)),(1));
  5563. $ctx1.sendIdx["assert:equals:"]=7;
  5564. $5=(1).__plus((2));
  5565. $ctx1.sendIdx["+"]=2;
  5566. $4=_st($5).__star((3));
  5567. $ctx1.sendIdx["*"]=2;
  5568. self._assert_equals_($4,(9));
  5569. $ctx1.sendIdx["assert:equals:"]=8;
  5570. self._assert_equals_((1).__plus((2).__star((3))),(7));
  5571. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.NumberTest)})},
  5572. args: [],
  5573. 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",
  5574. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"],
  5575. referencedClasses: []
  5576. }),
  5577. smalltalk.NumberTest);
  5578. smalltalk.addMethod(
  5579. smalltalk.method({
  5580. selector: "testAsNumber",
  5581. protocol: 'tests',
  5582. fn: function (){
  5583. var self=this;
  5584. return smalltalk.withContext(function($ctx1) {
  5585. self._assert_equals_((3)._asNumber(),(3));
  5586. return self}, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},smalltalk.NumberTest)})},
  5587. args: [],
  5588. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  5589. messageSends: ["assert:equals:", "asNumber"],
  5590. referencedClasses: []
  5591. }),
  5592. smalltalk.NumberTest);
  5593. smalltalk.addMethod(
  5594. smalltalk.method({
  5595. selector: "testCeiling",
  5596. protocol: 'tests',
  5597. fn: function (){
  5598. var self=this;
  5599. return smalltalk.withContext(function($ctx1) {
  5600. var $1,$2;
  5601. $1=(1.2)._ceiling();
  5602. $ctx1.sendIdx["ceiling"]=1;
  5603. self._assert_equals_($1,(2));
  5604. $ctx1.sendIdx["assert:equals:"]=1;
  5605. $2=(-1.2)._ceiling();
  5606. $ctx1.sendIdx["ceiling"]=2;
  5607. self._assert_equals_($2,(-1));
  5608. $ctx1.sendIdx["assert:equals:"]=2;
  5609. self._assert_equals_((1)._ceiling(),(1));
  5610. return self}, function($ctx1) {$ctx1.fill(self,"testCeiling",{},smalltalk.NumberTest)})},
  5611. args: [],
  5612. 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.",
  5613. messageSends: ["assert:equals:", "ceiling"],
  5614. referencedClasses: []
  5615. }),
  5616. smalltalk.NumberTest);
  5617. smalltalk.addMethod(
  5618. smalltalk.method({
  5619. selector: "testComparison",
  5620. protocol: 'tests',
  5621. fn: function (){
  5622. var self=this;
  5623. return smalltalk.withContext(function($ctx1) {
  5624. var $1,$2,$3,$4;
  5625. $1=(3).__gt((2));
  5626. $ctx1.sendIdx[">"]=1;
  5627. self._assert_($1);
  5628. $ctx1.sendIdx["assert:"]=1;
  5629. $2=(2).__lt((3));
  5630. $ctx1.sendIdx["<"]=1;
  5631. self._assert_($2);
  5632. $ctx1.sendIdx["assert:"]=2;
  5633. self._deny_((3).__lt((2)));
  5634. $ctx1.sendIdx["deny:"]=1;
  5635. self._deny_((2).__gt((3)));
  5636. $3=(3).__gt_eq((3));
  5637. $ctx1.sendIdx[">="]=1;
  5638. self._assert_($3);
  5639. $ctx1.sendIdx["assert:"]=3;
  5640. self._assert_((3.1).__gt_eq((3)));
  5641. $ctx1.sendIdx["assert:"]=4;
  5642. $4=(3).__lt_eq((3));
  5643. $ctx1.sendIdx["<="]=1;
  5644. self._assert_($4);
  5645. $ctx1.sendIdx["assert:"]=5;
  5646. self._assert_((3).__lt_eq((3.1)));
  5647. return self}, function($ctx1) {$ctx1.fill(self,"testComparison",{},smalltalk.NumberTest)})},
  5648. args: [],
  5649. 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",
  5650. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="],
  5651. referencedClasses: []
  5652. }),
  5653. smalltalk.NumberTest);
  5654. smalltalk.addMethod(
  5655. smalltalk.method({
  5656. selector: "testCopying",
  5657. protocol: 'tests',
  5658. fn: function (){
  5659. var self=this;
  5660. return smalltalk.withContext(function($ctx1) {
  5661. var $1;
  5662. $1=_st((1)._copy()).__eq_eq((1));
  5663. $ctx1.sendIdx["=="]=1;
  5664. self._assert_($1);
  5665. $ctx1.sendIdx["assert:"]=1;
  5666. self._assert_(_st((1)._deepCopy()).__eq_eq((1)));
  5667. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.NumberTest)})},
  5668. args: [],
  5669. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  5670. messageSends: ["assert:", "==", "copy", "deepCopy"],
  5671. referencedClasses: []
  5672. }),
  5673. smalltalk.NumberTest);
  5674. smalltalk.addMethod(
  5675. smalltalk.method({
  5676. selector: "testEquality",
  5677. protocol: 'tests',
  5678. fn: function (){
  5679. var self=this;
  5680. return smalltalk.withContext(function($ctx1) {
  5681. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  5682. $1=(1).__eq((1));
  5683. $ctx1.sendIdx["="]=1;
  5684. self._assert_($1);
  5685. $ctx1.sendIdx["assert:"]=1;
  5686. $2=(0).__eq((0));
  5687. $ctx1.sendIdx["="]=2;
  5688. self._assert_($2);
  5689. $ctx1.sendIdx["assert:"]=2;
  5690. $3=(1).__eq((0));
  5691. $ctx1.sendIdx["="]=3;
  5692. self._deny_($3);
  5693. $ctx1.sendIdx["deny:"]=1;
  5694. $5=(1)._yourself();
  5695. $ctx1.sendIdx["yourself"]=1;
  5696. $4=_st($5).__eq((1));
  5697. $ctx1.sendIdx["="]=4;
  5698. self._assert_($4);
  5699. $ctx1.sendIdx["assert:"]=3;
  5700. $7=(1)._yourself();
  5701. $ctx1.sendIdx["yourself"]=2;
  5702. $6=(1).__eq($7);
  5703. $ctx1.sendIdx["="]=5;
  5704. self._assert_($6);
  5705. $ctx1.sendIdx["assert:"]=4;
  5706. $9=(1)._yourself();
  5707. $ctx1.sendIdx["yourself"]=3;
  5708. $8=_st($9).__eq((1)._yourself());
  5709. $ctx1.sendIdx["="]=6;
  5710. self._assert_($8);
  5711. $10=(0).__eq(false);
  5712. $ctx1.sendIdx["="]=7;
  5713. self._deny_($10);
  5714. $ctx1.sendIdx["deny:"]=2;
  5715. $11=false.__eq((0));
  5716. $ctx1.sendIdx["="]=8;
  5717. self._deny_($11);
  5718. $ctx1.sendIdx["deny:"]=3;
  5719. $12="".__eq((0));
  5720. $ctx1.sendIdx["="]=9;
  5721. self._deny_($12);
  5722. $ctx1.sendIdx["deny:"]=4;
  5723. self._deny_((0).__eq(""));
  5724. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{},smalltalk.NumberTest)})},
  5725. args: [],
  5726. 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 = ''",
  5727. messageSends: ["assert:", "=", "deny:", "yourself"],
  5728. referencedClasses: []
  5729. }),
  5730. smalltalk.NumberTest);
  5731. smalltalk.addMethod(
  5732. smalltalk.method({
  5733. selector: "testFloor",
  5734. protocol: 'tests',
  5735. fn: function (){
  5736. var self=this;
  5737. return smalltalk.withContext(function($ctx1) {
  5738. var $1,$2;
  5739. $1=(1.2)._floor();
  5740. $ctx1.sendIdx["floor"]=1;
  5741. self._assert_equals_($1,(1));
  5742. $ctx1.sendIdx["assert:equals:"]=1;
  5743. $2=(-1.2)._floor();
  5744. $ctx1.sendIdx["floor"]=2;
  5745. self._assert_equals_($2,(-2));
  5746. $ctx1.sendIdx["assert:equals:"]=2;
  5747. self._assert_equals_((1)._floor(),(1));
  5748. return self}, function($ctx1) {$ctx1.fill(self,"testFloor",{},smalltalk.NumberTest)})},
  5749. args: [],
  5750. 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.",
  5751. messageSends: ["assert:equals:", "floor"],
  5752. referencedClasses: []
  5753. }),
  5754. smalltalk.NumberTest);
  5755. smalltalk.addMethod(
  5756. smalltalk.method({
  5757. selector: "testHexNumbers",
  5758. protocol: 'tests',
  5759. fn: function (){
  5760. var self=this;
  5761. return smalltalk.withContext(function($ctx1) {
  5762. var $1,$2,$3,$4,$5;
  5763. self._assert_equals_((9),(9));
  5764. $ctx1.sendIdx["assert:equals:"]=1;
  5765. $1=(10)._truncated();
  5766. $ctx1.sendIdx["truncated"]=1;
  5767. self._assert_equals_($1,(10));
  5768. $ctx1.sendIdx["assert:equals:"]=2;
  5769. $2=(11)._truncated();
  5770. $ctx1.sendIdx["truncated"]=2;
  5771. self._assert_equals_($2,(11));
  5772. $ctx1.sendIdx["assert:equals:"]=3;
  5773. $3=(12)._truncated();
  5774. $ctx1.sendIdx["truncated"]=3;
  5775. self._assert_equals_($3,(12));
  5776. $ctx1.sendIdx["assert:equals:"]=4;
  5777. $4=(13)._truncated();
  5778. $ctx1.sendIdx["truncated"]=4;
  5779. self._assert_equals_($4,(13));
  5780. $ctx1.sendIdx["assert:equals:"]=5;
  5781. $5=(14)._truncated();
  5782. $ctx1.sendIdx["truncated"]=5;
  5783. self._assert_equals_($5,(14));
  5784. $ctx1.sendIdx["assert:equals:"]=6;
  5785. self._assert_equals_((15)._truncated(),(15));
  5786. return self}, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},smalltalk.NumberTest)})},
  5787. args: [],
  5788. 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",
  5789. messageSends: ["assert:equals:", "truncated"],
  5790. referencedClasses: []
  5791. }),
  5792. smalltalk.NumberTest);
  5793. smalltalk.addMethod(
  5794. smalltalk.method({
  5795. selector: "testIdentity",
  5796. protocol: 'tests',
  5797. fn: function (){
  5798. var self=this;
  5799. return smalltalk.withContext(function($ctx1) {
  5800. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  5801. $1=(1).__eq_eq((1));
  5802. $ctx1.sendIdx["=="]=1;
  5803. self._assert_($1);
  5804. $ctx1.sendIdx["assert:"]=1;
  5805. $2=(0).__eq_eq((0));
  5806. $ctx1.sendIdx["=="]=2;
  5807. self._assert_($2);
  5808. $ctx1.sendIdx["assert:"]=2;
  5809. $3=(1).__eq_eq((0));
  5810. $ctx1.sendIdx["=="]=3;
  5811. self._deny_($3);
  5812. $ctx1.sendIdx["deny:"]=1;
  5813. $5=(1)._yourself();
  5814. $ctx1.sendIdx["yourself"]=1;
  5815. $4=_st($5).__eq_eq((1));
  5816. $ctx1.sendIdx["=="]=4;
  5817. self._assert_($4);
  5818. $ctx1.sendIdx["assert:"]=3;
  5819. $7=(1)._yourself();
  5820. $ctx1.sendIdx["yourself"]=2;
  5821. $6=(1).__eq_eq($7);
  5822. $ctx1.sendIdx["=="]=5;
  5823. self._assert_($6);
  5824. $ctx1.sendIdx["assert:"]=4;
  5825. $9=(1)._yourself();
  5826. $ctx1.sendIdx["yourself"]=3;
  5827. $8=_st($9).__eq_eq((1)._yourself());
  5828. $ctx1.sendIdx["=="]=6;
  5829. self._assert_($8);
  5830. self._deny_((1).__eq_eq((2)));
  5831. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{},smalltalk.NumberTest)})},
  5832. args: [],
  5833. 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",
  5834. messageSends: ["assert:", "==", "deny:", "yourself"],
  5835. referencedClasses: []
  5836. }),
  5837. smalltalk.NumberTest);
  5838. smalltalk.addMethod(
  5839. smalltalk.method({
  5840. selector: "testInvalidHexNumbers",
  5841. protocol: 'tests',
  5842. fn: function (){
  5843. var self=this;
  5844. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  5845. return smalltalk.withContext(function($ctx1) {
  5846. self._should_raise_((function(){
  5847. return smalltalk.withContext(function($ctx2) {
  5848. return (16)._rG();
  5849. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  5850. $ctx1.sendIdx["should:raise:"]=1;
  5851. self._should_raise_((function(){
  5852. return smalltalk.withContext(function($ctx2) {
  5853. return (16)._rg();
  5854. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),$MessageNotUnderstood());
  5855. $ctx1.sendIdx["should:raise:"]=2;
  5856. self._should_raise_((function(){
  5857. return smalltalk.withContext(function($ctx2) {
  5858. return (16)._rH();
  5859. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}),$MessageNotUnderstood());
  5860. $ctx1.sendIdx["should:raise:"]=3;
  5861. self._should_raise_((function(){
  5862. return smalltalk.withContext(function($ctx2) {
  5863. return (16)._rh();
  5864. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}),$MessageNotUnderstood());
  5865. $ctx1.sendIdx["should:raise:"]=4;
  5866. self._should_raise_((function(){
  5867. return smalltalk.withContext(function($ctx2) {
  5868. return (16)._rI();
  5869. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}),$MessageNotUnderstood());
  5870. $ctx1.sendIdx["should:raise:"]=5;
  5871. self._should_raise_((function(){
  5872. return smalltalk.withContext(function($ctx2) {
  5873. return (16)._ri();
  5874. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)})}),$MessageNotUnderstood());
  5875. $ctx1.sendIdx["should:raise:"]=6;
  5876. self._should_raise_((function(){
  5877. return smalltalk.withContext(function($ctx2) {
  5878. return (16)._rJ();
  5879. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}),$MessageNotUnderstood());
  5880. $ctx1.sendIdx["should:raise:"]=7;
  5881. self._should_raise_((function(){
  5882. return smalltalk.withContext(function($ctx2) {
  5883. return (16)._rj();
  5884. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)})}),$MessageNotUnderstood());
  5885. $ctx1.sendIdx["should:raise:"]=8;
  5886. self._should_raise_((function(){
  5887. return smalltalk.withContext(function($ctx2) {
  5888. return (16)._rK();
  5889. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)})}),$MessageNotUnderstood());
  5890. $ctx1.sendIdx["should:raise:"]=9;
  5891. self._should_raise_((function(){
  5892. return smalltalk.withContext(function($ctx2) {
  5893. return (16)._rk();
  5894. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)})}),$MessageNotUnderstood());
  5895. $ctx1.sendIdx["should:raise:"]=10;
  5896. self._should_raise_((function(){
  5897. return smalltalk.withContext(function($ctx2) {
  5898. return (16)._rL();
  5899. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)})}),$MessageNotUnderstood());
  5900. $ctx1.sendIdx["should:raise:"]=11;
  5901. self._should_raise_((function(){
  5902. return smalltalk.withContext(function($ctx2) {
  5903. return (16)._rl();
  5904. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)})}),$MessageNotUnderstood());
  5905. $ctx1.sendIdx["should:raise:"]=12;
  5906. self._should_raise_((function(){
  5907. return smalltalk.withContext(function($ctx2) {
  5908. return (16)._rM();
  5909. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)})}),$MessageNotUnderstood());
  5910. $ctx1.sendIdx["should:raise:"]=13;
  5911. self._should_raise_((function(){
  5912. return smalltalk.withContext(function($ctx2) {
  5913. return (16)._rm();
  5914. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)})}),$MessageNotUnderstood());
  5915. $ctx1.sendIdx["should:raise:"]=14;
  5916. self._should_raise_((function(){
  5917. return smalltalk.withContext(function($ctx2) {
  5918. return (16)._rN();
  5919. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)})}),$MessageNotUnderstood());
  5920. $ctx1.sendIdx["should:raise:"]=15;
  5921. self._should_raise_((function(){
  5922. return smalltalk.withContext(function($ctx2) {
  5923. return (16)._rn();
  5924. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)})}),$MessageNotUnderstood());
  5925. $ctx1.sendIdx["should:raise:"]=16;
  5926. self._should_raise_((function(){
  5927. return smalltalk.withContext(function($ctx2) {
  5928. return (16)._rO();
  5929. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)})}),$MessageNotUnderstood());
  5930. $ctx1.sendIdx["should:raise:"]=17;
  5931. self._should_raise_((function(){
  5932. return smalltalk.withContext(function($ctx2) {
  5933. return (16)._ro();
  5934. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)})}),$MessageNotUnderstood());
  5935. $ctx1.sendIdx["should:raise:"]=18;
  5936. self._should_raise_((function(){
  5937. return smalltalk.withContext(function($ctx2) {
  5938. return (16)._rP();
  5939. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)})}),$MessageNotUnderstood());
  5940. $ctx1.sendIdx["should:raise:"]=19;
  5941. self._should_raise_((function(){
  5942. return smalltalk.withContext(function($ctx2) {
  5943. return (16)._rp();
  5944. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)})}),$MessageNotUnderstood());
  5945. $ctx1.sendIdx["should:raise:"]=20;
  5946. self._should_raise_((function(){
  5947. return smalltalk.withContext(function($ctx2) {
  5948. return (16)._rQ();
  5949. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)})}),$MessageNotUnderstood());
  5950. $ctx1.sendIdx["should:raise:"]=21;
  5951. self._should_raise_((function(){
  5952. return smalltalk.withContext(function($ctx2) {
  5953. return (16)._rq();
  5954. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)})}),$MessageNotUnderstood());
  5955. $ctx1.sendIdx["should:raise:"]=22;
  5956. self._should_raise_((function(){
  5957. return smalltalk.withContext(function($ctx2) {
  5958. return (16)._rR();
  5959. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)})}),$MessageNotUnderstood());
  5960. $ctx1.sendIdx["should:raise:"]=23;
  5961. self._should_raise_((function(){
  5962. return smalltalk.withContext(function($ctx2) {
  5963. return (16)._rr();
  5964. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)})}),$MessageNotUnderstood());
  5965. $ctx1.sendIdx["should:raise:"]=24;
  5966. self._should_raise_((function(){
  5967. return smalltalk.withContext(function($ctx2) {
  5968. return (16)._rS();
  5969. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)})}),$MessageNotUnderstood());
  5970. $ctx1.sendIdx["should:raise:"]=25;
  5971. self._should_raise_((function(){
  5972. return smalltalk.withContext(function($ctx2) {
  5973. return (16)._rs();
  5974. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)})}),$MessageNotUnderstood());
  5975. $ctx1.sendIdx["should:raise:"]=26;
  5976. self._should_raise_((function(){
  5977. return smalltalk.withContext(function($ctx2) {
  5978. return (16)._rT();
  5979. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)})}),$MessageNotUnderstood());
  5980. $ctx1.sendIdx["should:raise:"]=27;
  5981. self._should_raise_((function(){
  5982. return smalltalk.withContext(function($ctx2) {
  5983. return (16)._rt();
  5984. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)})}),$MessageNotUnderstood());
  5985. $ctx1.sendIdx["should:raise:"]=28;
  5986. self._should_raise_((function(){
  5987. return smalltalk.withContext(function($ctx2) {
  5988. return (16)._rU();
  5989. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)})}),$MessageNotUnderstood());
  5990. $ctx1.sendIdx["should:raise:"]=29;
  5991. self._should_raise_((function(){
  5992. return smalltalk.withContext(function($ctx2) {
  5993. return (16)._ru();
  5994. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)})}),$MessageNotUnderstood());
  5995. $ctx1.sendIdx["should:raise:"]=30;
  5996. self._should_raise_((function(){
  5997. return smalltalk.withContext(function($ctx2) {
  5998. return (16)._rV();
  5999. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)})}),$MessageNotUnderstood());
  6000. $ctx1.sendIdx["should:raise:"]=31;
  6001. self._should_raise_((function(){
  6002. return smalltalk.withContext(function($ctx2) {
  6003. return (16)._rv();
  6004. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)})}),$MessageNotUnderstood());
  6005. $ctx1.sendIdx["should:raise:"]=32;
  6006. self._should_raise_((function(){
  6007. return smalltalk.withContext(function($ctx2) {
  6008. return (16)._rW();
  6009. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)})}),$MessageNotUnderstood());
  6010. $ctx1.sendIdx["should:raise:"]=33;
  6011. self._should_raise_((function(){
  6012. return smalltalk.withContext(function($ctx2) {
  6013. return (16)._rw();
  6014. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)})}),$MessageNotUnderstood());
  6015. $ctx1.sendIdx["should:raise:"]=34;
  6016. self._should_raise_((function(){
  6017. return smalltalk.withContext(function($ctx2) {
  6018. return (16)._rX();
  6019. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)})}),$MessageNotUnderstood());
  6020. $ctx1.sendIdx["should:raise:"]=35;
  6021. self._should_raise_((function(){
  6022. return smalltalk.withContext(function($ctx2) {
  6023. return (16)._rx();
  6024. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)})}),$MessageNotUnderstood());
  6025. $ctx1.sendIdx["should:raise:"]=36;
  6026. self._should_raise_((function(){
  6027. return smalltalk.withContext(function($ctx2) {
  6028. return (16)._rY();
  6029. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)})}),$MessageNotUnderstood());
  6030. $ctx1.sendIdx["should:raise:"]=37;
  6031. self._should_raise_((function(){
  6032. return smalltalk.withContext(function($ctx2) {
  6033. return (16)._ry();
  6034. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)})}),$MessageNotUnderstood());
  6035. $ctx1.sendIdx["should:raise:"]=38;
  6036. self._should_raise_((function(){
  6037. return smalltalk.withContext(function($ctx2) {
  6038. return (16)._rZ();
  6039. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)})}),$MessageNotUnderstood());
  6040. $ctx1.sendIdx["should:raise:"]=39;
  6041. self._should_raise_((function(){
  6042. return smalltalk.withContext(function($ctx2) {
  6043. return (16)._rz();
  6044. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)})}),$MessageNotUnderstood());
  6045. $ctx1.sendIdx["should:raise:"]=40;
  6046. self._should_raise_((function(){
  6047. return smalltalk.withContext(function($ctx2) {
  6048. return (11259375)._Z();
  6049. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)})}),$MessageNotUnderstood());
  6050. return self}, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},smalltalk.NumberTest)})},
  6051. args: [],
  6052. 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.",
  6053. 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"],
  6054. referencedClasses: ["MessageNotUnderstood"]
  6055. }),
  6056. smalltalk.NumberTest);
  6057. smalltalk.addMethod(
  6058. smalltalk.method({
  6059. selector: "testLog",
  6060. protocol: 'tests',
  6061. fn: function (){
  6062. var self=this;
  6063. function $Number(){return smalltalk.Number||(typeof Number=="undefined"?nil:Number)}
  6064. return smalltalk.withContext(function($ctx1) {
  6065. self._assert_equals_((10000)._log(),(4));
  6066. $ctx1.sendIdx["assert:equals:"]=1;
  6067. self._assert_equals_((512)._log_((2)),(9));
  6068. $ctx1.sendIdx["assert:equals:"]=2;
  6069. self._assert_equals_(_st(_st($Number())._e())._ln(),(1));
  6070. return self}, function($ctx1) {$ctx1.fill(self,"testLog",{},smalltalk.NumberTest)})},
  6071. args: [],
  6072. 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.",
  6073. messageSends: ["assert:equals:", "log", "log:", "ln", "e"],
  6074. referencedClasses: ["Number"]
  6075. }),
  6076. smalltalk.NumberTest);
  6077. smalltalk.addMethod(
  6078. smalltalk.method({
  6079. selector: "testMinMax",
  6080. protocol: 'tests',
  6081. fn: function (){
  6082. var self=this;
  6083. return smalltalk.withContext(function($ctx1) {
  6084. self._assert_equals_((2)._max_((5)),(5));
  6085. $ctx1.sendIdx["assert:equals:"]=1;
  6086. self._assert_equals_((2)._min_((5)),(2));
  6087. return self}, function($ctx1) {$ctx1.fill(self,"testMinMax",{},smalltalk.NumberTest)})},
  6088. args: [],
  6089. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2",
  6090. messageSends: ["assert:equals:", "max:", "min:"],
  6091. referencedClasses: []
  6092. }),
  6093. smalltalk.NumberTest);
  6094. smalltalk.addMethod(
  6095. smalltalk.method({
  6096. selector: "testNegated",
  6097. protocol: 'tests',
  6098. fn: function (){
  6099. var self=this;
  6100. return smalltalk.withContext(function($ctx1) {
  6101. var $1;
  6102. $1=(3)._negated();
  6103. $ctx1.sendIdx["negated"]=1;
  6104. self._assert_equals_($1,(-3));
  6105. $ctx1.sendIdx["assert:equals:"]=1;
  6106. self._assert_equals_((-3)._negated(),(3));
  6107. return self}, function($ctx1) {$ctx1.fill(self,"testNegated",{},smalltalk.NumberTest)})},
  6108. args: [],
  6109. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  6110. messageSends: ["assert:equals:", "negated"],
  6111. referencedClasses: []
  6112. }),
  6113. smalltalk.NumberTest);
  6114. smalltalk.addMethod(
  6115. smalltalk.method({
  6116. selector: "testPrintShowingDecimalPlaces",
  6117. protocol: 'tests',
  6118. fn: function (){
  6119. var self=this;
  6120. return smalltalk.withContext(function($ctx1) {
  6121. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  6122. $1=(23)._printShowingDecimalPlaces_((2));
  6123. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  6124. self._assert_equals_($1,"23.00");
  6125. $ctx1.sendIdx["assert:equals:"]=1;
  6126. $2=(23.5698)._printShowingDecimalPlaces_((2));
  6127. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  6128. self._assert_equals_($2,"23.57");
  6129. $ctx1.sendIdx["assert:equals:"]=2;
  6130. $4=(234.567)._negated();
  6131. $ctx1.sendIdx["negated"]=1;
  6132. $3=_st($4)._printShowingDecimalPlaces_((5));
  6133. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  6134. self._assert_equals_($3,"-234.56700");
  6135. $ctx1.sendIdx["assert:equals:"]=3;
  6136. $5=(23.4567)._printShowingDecimalPlaces_((0));
  6137. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  6138. self._assert_equals_($5,"23");
  6139. $ctx1.sendIdx["assert:equals:"]=4;
  6140. $6=(23.5567)._printShowingDecimalPlaces_((0));
  6141. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  6142. self._assert_equals_($6,"24");
  6143. $ctx1.sendIdx["assert:equals:"]=5;
  6144. $8=(23.4567)._negated();
  6145. $ctx1.sendIdx["negated"]=2;
  6146. $7=_st($8)._printShowingDecimalPlaces_((0));
  6147. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  6148. self._assert_equals_($7,"-23");
  6149. $ctx1.sendIdx["assert:equals:"]=6;
  6150. $10=(23.5567)._negated();
  6151. $ctx1.sendIdx["negated"]=3;
  6152. $9=_st($10)._printShowingDecimalPlaces_((0));
  6153. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  6154. self._assert_equals_($9,"-24");
  6155. $ctx1.sendIdx["assert:equals:"]=7;
  6156. $11=(100000000)._printShowingDecimalPlaces_((1));
  6157. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  6158. self._assert_equals_($11,"100000000.0");
  6159. $ctx1.sendIdx["assert:equals:"]=8;
  6160. $12=(0.98)._printShowingDecimalPlaces_((5));
  6161. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  6162. self._assert_equals_($12,"0.98000");
  6163. $ctx1.sendIdx["assert:equals:"]=9;
  6164. $13=_st((0.98)._negated())._printShowingDecimalPlaces_((2));
  6165. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  6166. self._assert_equals_($13,"-0.98");
  6167. $ctx1.sendIdx["assert:equals:"]=10;
  6168. $14=(2.567)._printShowingDecimalPlaces_((2));
  6169. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  6170. self._assert_equals_($14,"2.57");
  6171. $ctx1.sendIdx["assert:equals:"]=11;
  6172. $15=(-2.567)._printShowingDecimalPlaces_((2));
  6173. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  6174. self._assert_equals_($15,"-2.57");
  6175. $ctx1.sendIdx["assert:equals:"]=12;
  6176. self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  6177. return self}, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},smalltalk.NumberTest)})},
  6178. args: [],
  6179. 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'.",
  6180. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"],
  6181. referencedClasses: []
  6182. }),
  6183. smalltalk.NumberTest);
  6184. smalltalk.addMethod(
  6185. smalltalk.method({
  6186. selector: "testRaisedTo",
  6187. protocol: 'tests',
  6188. fn: function (){
  6189. var self=this;
  6190. return smalltalk.withContext(function($ctx1) {
  6191. var $1,$2,$3;
  6192. $1=(2)._raisedTo_((4));
  6193. $ctx1.sendIdx["raisedTo:"]=1;
  6194. self._assert_equals_($1,(16));
  6195. $ctx1.sendIdx["assert:equals:"]=1;
  6196. $2=(2)._raisedTo_((0));
  6197. $ctx1.sendIdx["raisedTo:"]=2;
  6198. self._assert_equals_($2,(1));
  6199. $ctx1.sendIdx["assert:equals:"]=2;
  6200. $3=(2)._raisedTo_((-3));
  6201. $ctx1.sendIdx["raisedTo:"]=3;
  6202. self._assert_equals_($3,(0.125));
  6203. $ctx1.sendIdx["assert:equals:"]=3;
  6204. self._assert_equals_((4)._raisedTo_((0.5)),(2));
  6205. $ctx1.sendIdx["assert:equals:"]=4;
  6206. self._assert_equals_((2).__star_star((4)),(16));
  6207. return self}, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},smalltalk.NumberTest)})},
  6208. args: [],
  6209. 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.",
  6210. messageSends: ["assert:equals:", "raisedTo:", "**"],
  6211. referencedClasses: []
  6212. }),
  6213. smalltalk.NumberTest);
  6214. smalltalk.addMethod(
  6215. smalltalk.method({
  6216. selector: "testRounded",
  6217. protocol: 'tests',
  6218. fn: function (){
  6219. var self=this;
  6220. return smalltalk.withContext(function($ctx1) {
  6221. var $1,$2;
  6222. $1=(3)._rounded();
  6223. $ctx1.sendIdx["rounded"]=1;
  6224. self._assert_equals_($1,(3));
  6225. $ctx1.sendIdx["assert:equals:"]=1;
  6226. $2=(3.212)._rounded();
  6227. $ctx1.sendIdx["rounded"]=2;
  6228. self._assert_equals_($2,(3));
  6229. $ctx1.sendIdx["assert:equals:"]=2;
  6230. self._assert_equals_((3.51)._rounded(),(4));
  6231. return self}, function($ctx1) {$ctx1.fill(self,"testRounded",{},smalltalk.NumberTest)})},
  6232. args: [],
  6233. 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",
  6234. messageSends: ["assert:equals:", "rounded"],
  6235. referencedClasses: []
  6236. }),
  6237. smalltalk.NumberTest);
  6238. smalltalk.addMethod(
  6239. smalltalk.method({
  6240. selector: "testSign",
  6241. protocol: 'tests',
  6242. fn: function (){
  6243. var self=this;
  6244. return smalltalk.withContext(function($ctx1) {
  6245. var $1,$2;
  6246. $1=(5)._sign();
  6247. $ctx1.sendIdx["sign"]=1;
  6248. self._assert_equals_($1,(1));
  6249. $ctx1.sendIdx["assert:equals:"]=1;
  6250. $2=(0)._sign();
  6251. $ctx1.sendIdx["sign"]=2;
  6252. self._assert_equals_($2,(0));
  6253. $ctx1.sendIdx["assert:equals:"]=2;
  6254. self._assert_equals_((-1.4)._sign(),(-1));
  6255. return self}, function($ctx1) {$ctx1.fill(self,"testSign",{},smalltalk.NumberTest)})},
  6256. args: [],
  6257. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  6258. messageSends: ["assert:equals:", "sign"],
  6259. referencedClasses: []
  6260. }),
  6261. smalltalk.NumberTest);
  6262. smalltalk.addMethod(
  6263. smalltalk.method({
  6264. selector: "testSqrt",
  6265. protocol: 'tests',
  6266. fn: function (){
  6267. var self=this;
  6268. return smalltalk.withContext(function($ctx1) {
  6269. var $1;
  6270. $1=(4)._sqrt();
  6271. $ctx1.sendIdx["sqrt"]=1;
  6272. self._assert_equals_($1,(2));
  6273. $ctx1.sendIdx["assert:equals:"]=1;
  6274. self._assert_equals_((16)._sqrt(),(4));
  6275. return self}, function($ctx1) {$ctx1.fill(self,"testSqrt",{},smalltalk.NumberTest)})},
  6276. args: [],
  6277. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  6278. messageSends: ["assert:equals:", "sqrt"],
  6279. referencedClasses: []
  6280. }),
  6281. smalltalk.NumberTest);
  6282. smalltalk.addMethod(
  6283. smalltalk.method({
  6284. selector: "testSquared",
  6285. protocol: 'tests',
  6286. fn: function (){
  6287. var self=this;
  6288. return smalltalk.withContext(function($ctx1) {
  6289. self._assert_equals_((4)._squared(),(16));
  6290. return self}, function($ctx1) {$ctx1.fill(self,"testSquared",{},smalltalk.NumberTest)})},
  6291. args: [],
  6292. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  6293. messageSends: ["assert:equals:", "squared"],
  6294. referencedClasses: []
  6295. }),
  6296. smalltalk.NumberTest);
  6297. smalltalk.addMethod(
  6298. smalltalk.method({
  6299. selector: "testTimesRepeat",
  6300. protocol: 'tests',
  6301. fn: function (){
  6302. var self=this;
  6303. var i;
  6304. return smalltalk.withContext(function($ctx1) {
  6305. i=(0);
  6306. (0)._timesRepeat_((function(){
  6307. return smalltalk.withContext(function($ctx2) {
  6308. i=_st(i).__plus((1));
  6309. $ctx2.sendIdx["+"]=1;
  6310. return i;
  6311. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  6312. $ctx1.sendIdx["timesRepeat:"]=1;
  6313. self._assert_equals_(i,(0));
  6314. $ctx1.sendIdx["assert:equals:"]=1;
  6315. (5)._timesRepeat_((function(){
  6316. return smalltalk.withContext(function($ctx2) {
  6317. i=_st(i).__plus((1));
  6318. return i;
  6319. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  6320. self._assert_equals_(i,(5));
  6321. return self}, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},smalltalk.NumberTest)})},
  6322. args: [],
  6323. 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",
  6324. messageSends: ["timesRepeat:", "+", "assert:equals:"],
  6325. referencedClasses: []
  6326. }),
  6327. smalltalk.NumberTest);
  6328. smalltalk.addMethod(
  6329. smalltalk.method({
  6330. selector: "testTo",
  6331. protocol: 'tests',
  6332. fn: function (){
  6333. var self=this;
  6334. return smalltalk.withContext(function($ctx1) {
  6335. self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  6336. return self}, function($ctx1) {$ctx1.fill(self,"testTo",{},smalltalk.NumberTest)})},
  6337. args: [],
  6338. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  6339. messageSends: ["assert:equals:", "to:"],
  6340. referencedClasses: []
  6341. }),
  6342. smalltalk.NumberTest);
  6343. smalltalk.addMethod(
  6344. smalltalk.method({
  6345. selector: "testToBy",
  6346. protocol: 'tests',
  6347. fn: function (){
  6348. var self=this;
  6349. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6350. return smalltalk.withContext(function($ctx1) {
  6351. var $1;
  6352. $1=(0)._to_by_((6),(2));
  6353. $ctx1.sendIdx["to:by:"]=1;
  6354. self._assert_equals_($1,[(0), (2), (4), (6)]);
  6355. self._should_raise_((function(){
  6356. return smalltalk.withContext(function($ctx2) {
  6357. return (1)._to_by_((4),(0));
  6358. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  6359. return self}, function($ctx1) {$ctx1.fill(self,"testToBy",{},smalltalk.NumberTest)})},
  6360. args: [],
  6361. 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",
  6362. messageSends: ["assert:equals:", "to:by:", "should:raise:"],
  6363. referencedClasses: ["Error"]
  6364. }),
  6365. smalltalk.NumberTest);
  6366. smalltalk.addMethod(
  6367. smalltalk.method({
  6368. selector: "testTrigonometry",
  6369. protocol: 'tests',
  6370. fn: function (){
  6371. var self=this;
  6372. return smalltalk.withContext(function($ctx1) {
  6373. self._assert_equals_((0)._cos(),(1));
  6374. $ctx1.sendIdx["assert:equals:"]=1;
  6375. self._assert_equals_((0)._sin(),(0));
  6376. $ctx1.sendIdx["assert:equals:"]=2;
  6377. self._assert_equals_((0)._tan(),(0));
  6378. $ctx1.sendIdx["assert:equals:"]=3;
  6379. self._assert_equals_((1)._arcCos(),(0));
  6380. $ctx1.sendIdx["assert:equals:"]=4;
  6381. self._assert_equals_((0)._arcSin(),(0));
  6382. $ctx1.sendIdx["assert:equals:"]=5;
  6383. self._assert_equals_((0)._arcTan(),(0));
  6384. return self}, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},smalltalk.NumberTest)})},
  6385. args: [],
  6386. 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.",
  6387. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan"],
  6388. referencedClasses: []
  6389. }),
  6390. smalltalk.NumberTest);
  6391. smalltalk.addMethod(
  6392. smalltalk.method({
  6393. selector: "testTruncated",
  6394. protocol: 'tests',
  6395. fn: function (){
  6396. var self=this;
  6397. return smalltalk.withContext(function($ctx1) {
  6398. var $1,$2;
  6399. $1=(3)._truncated();
  6400. $ctx1.sendIdx["truncated"]=1;
  6401. self._assert_equals_($1,(3));
  6402. $ctx1.sendIdx["assert:equals:"]=1;
  6403. $2=(3.212)._truncated();
  6404. $ctx1.sendIdx["truncated"]=2;
  6405. self._assert_equals_($2,(3));
  6406. $ctx1.sendIdx["assert:equals:"]=2;
  6407. self._assert_equals_((3.51)._truncated(),(3));
  6408. return self}, function($ctx1) {$ctx1.fill(self,"testTruncated",{},smalltalk.NumberTest)})},
  6409. args: [],
  6410. 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",
  6411. messageSends: ["assert:equals:", "truncated"],
  6412. referencedClasses: []
  6413. }),
  6414. smalltalk.NumberTest);
  6415. smalltalk.addClass('ObjectMock', smalltalk.Object, ['foo', 'bar'], 'Kernel-Tests');
  6416. smalltalk.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  6417. smalltalk.addMethod(
  6418. smalltalk.method({
  6419. selector: "foo",
  6420. protocol: 'not yet classified',
  6421. fn: function (){
  6422. var self=this;
  6423. return smalltalk.withContext(function($ctx1) {
  6424. var $1;
  6425. $1=self["@foo"];
  6426. return $1;
  6427. }, function($ctx1) {$ctx1.fill(self,"foo",{},smalltalk.ObjectMock)})},
  6428. args: [],
  6429. source: "foo\x0a\x09^ foo",
  6430. messageSends: [],
  6431. referencedClasses: []
  6432. }),
  6433. smalltalk.ObjectMock);
  6434. smalltalk.addMethod(
  6435. smalltalk.method({
  6436. selector: "foo:",
  6437. protocol: 'not yet classified',
  6438. fn: function (anObject){
  6439. var self=this;
  6440. return smalltalk.withContext(function($ctx1) {
  6441. self["@foo"]=anObject;
  6442. return self}, function($ctx1) {$ctx1.fill(self,"foo:",{anObject:anObject},smalltalk.ObjectMock)})},
  6443. args: ["anObject"],
  6444. source: "foo: anObject\x0a\x09foo := anObject",
  6445. messageSends: [],
  6446. referencedClasses: []
  6447. }),
  6448. smalltalk.ObjectMock);
  6449. smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6450. smalltalk.addMethod(
  6451. smalltalk.method({
  6452. selector: "notDefined",
  6453. protocol: 'tests',
  6454. fn: function (){
  6455. var self=this;
  6456. return smalltalk.withContext(function($ctx1) {
  6457. return void 0;;
  6458. return self}, function($ctx1) {$ctx1.fill(self,"notDefined",{},smalltalk.ObjectTest)})},
  6459. args: [],
  6460. source: "notDefined\x0a\x09<return void 0;>",
  6461. messageSends: [],
  6462. referencedClasses: []
  6463. }),
  6464. smalltalk.ObjectTest);
  6465. smalltalk.addMethod(
  6466. smalltalk.method({
  6467. selector: "testBasicAccess",
  6468. protocol: 'tests',
  6469. fn: function (){
  6470. var self=this;
  6471. var o;
  6472. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  6473. return smalltalk.withContext(function($ctx1) {
  6474. var $1;
  6475. o=_st($Object())._new();
  6476. _st(o)._basicAt_put_("a",(1));
  6477. $1=_st(o)._basicAt_("a");
  6478. $ctx1.sendIdx["basicAt:"]=1;
  6479. self._assert_equals_($1,(1));
  6480. $ctx1.sendIdx["assert:equals:"]=1;
  6481. self._assert_equals_(_st(o)._basicAt_("b"),nil);
  6482. return self}, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},smalltalk.ObjectTest)})},
  6483. args: [],
  6484. 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",
  6485. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"],
  6486. referencedClasses: ["Object"]
  6487. }),
  6488. smalltalk.ObjectTest);
  6489. smalltalk.addMethod(
  6490. smalltalk.method({
  6491. selector: "testBasicPerform",
  6492. protocol: 'tests',
  6493. fn: function (){
  6494. var self=this;
  6495. var o;
  6496. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  6497. return smalltalk.withContext(function($ctx1) {
  6498. o=_st($Object())._new();
  6499. _st(o)._basicAt_put_("func",(function(){
  6500. return smalltalk.withContext(function($ctx2) {
  6501. return "hello";
  6502. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  6503. $ctx1.sendIdx["basicAt:put:"]=1;
  6504. _st(o)._basicAt_put_("func2",(function(a){
  6505. return smalltalk.withContext(function($ctx2) {
  6506. return _st(a).__plus((1));
  6507. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)})}));
  6508. self._assert_equals_(_st(o)._basicPerform_("func"),"hello");
  6509. $ctx1.sendIdx["assert:equals:"]=1;
  6510. self._assert_equals_(_st(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  6511. return self}, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},smalltalk.ObjectTest)})},
  6512. args: [],
  6513. 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",
  6514. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"],
  6515. referencedClasses: ["Object"]
  6516. }),
  6517. smalltalk.ObjectTest);
  6518. smalltalk.addMethod(
  6519. smalltalk.method({
  6520. selector: "testDNU",
  6521. protocol: 'tests',
  6522. fn: function (){
  6523. var self=this;
  6524. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  6525. function $MessageNotUnderstood(){return smalltalk.MessageNotUnderstood||(typeof MessageNotUnderstood=="undefined"?nil:MessageNotUnderstood)}
  6526. return smalltalk.withContext(function($ctx1) {
  6527. self._should_raise_((function(){
  6528. return smalltalk.withContext(function($ctx2) {
  6529. return _st(_st($Object())._new())._foo();
  6530. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$MessageNotUnderstood());
  6531. return self}, function($ctx1) {$ctx1.fill(self,"testDNU",{},smalltalk.ObjectTest)})},
  6532. args: [],
  6533. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  6534. messageSends: ["should:raise:", "foo", "new"],
  6535. referencedClasses: ["Object", "MessageNotUnderstood"]
  6536. }),
  6537. smalltalk.ObjectTest);
  6538. smalltalk.addMethod(
  6539. smalltalk.method({
  6540. selector: "testEquality",
  6541. protocol: 'tests',
  6542. fn: function (){
  6543. var self=this;
  6544. var o;
  6545. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  6546. return smalltalk.withContext(function($ctx1) {
  6547. var $1,$2,$4,$3;
  6548. o=_st($Object())._new();
  6549. $ctx1.sendIdx["new"]=1;
  6550. $1=_st(o).__eq(_st($Object())._new());
  6551. $ctx1.sendIdx["="]=1;
  6552. self._deny_($1);
  6553. $2=_st(o).__eq(o);
  6554. $ctx1.sendIdx["="]=2;
  6555. self._assert_($2);
  6556. $ctx1.sendIdx["assert:"]=1;
  6557. $4=_st(o)._yourself();
  6558. $ctx1.sendIdx["yourself"]=1;
  6559. $3=_st($4).__eq(o);
  6560. $ctx1.sendIdx["="]=3;
  6561. self._assert_($3);
  6562. $ctx1.sendIdx["assert:"]=2;
  6563. self._assert_(_st(o).__eq(_st(o)._yourself()));
  6564. return self}, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},smalltalk.ObjectTest)})},
  6565. args: [],
  6566. 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)",
  6567. messageSends: ["new", "deny:", "=", "assert:", "yourself"],
  6568. referencedClasses: ["Object"]
  6569. }),
  6570. smalltalk.ObjectTest);
  6571. smalltalk.addMethod(
  6572. smalltalk.method({
  6573. selector: "testHalt",
  6574. protocol: 'tests',
  6575. fn: function (){
  6576. var self=this;
  6577. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  6578. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  6579. return smalltalk.withContext(function($ctx1) {
  6580. self._should_raise_((function(){
  6581. return smalltalk.withContext(function($ctx2) {
  6582. return _st(_st($Object())._new())._halt();
  6583. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  6584. return self}, function($ctx1) {$ctx1.fill(self,"testHalt",{},smalltalk.ObjectTest)})},
  6585. args: [],
  6586. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  6587. messageSends: ["should:raise:", "halt", "new"],
  6588. referencedClasses: ["Object", "Error"]
  6589. }),
  6590. smalltalk.ObjectTest);
  6591. smalltalk.addMethod(
  6592. smalltalk.method({
  6593. selector: "testIdentity",
  6594. protocol: 'tests',
  6595. fn: function (){
  6596. var self=this;
  6597. var o;
  6598. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  6599. return smalltalk.withContext(function($ctx1) {
  6600. var $1,$2,$4,$3;
  6601. o=_st($Object())._new();
  6602. $ctx1.sendIdx["new"]=1;
  6603. $1=_st(o).__eq_eq(_st($Object())._new());
  6604. $ctx1.sendIdx["=="]=1;
  6605. self._deny_($1);
  6606. $2=_st(o).__eq_eq(o);
  6607. $ctx1.sendIdx["=="]=2;
  6608. self._assert_($2);
  6609. $ctx1.sendIdx["assert:"]=1;
  6610. $4=_st(o)._yourself();
  6611. $ctx1.sendIdx["yourself"]=1;
  6612. $3=_st($4).__eq_eq(o);
  6613. $ctx1.sendIdx["=="]=3;
  6614. self._assert_($3);
  6615. $ctx1.sendIdx["assert:"]=2;
  6616. self._assert_(_st(o).__eq_eq(_st(o)._yourself()));
  6617. return self}, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},smalltalk.ObjectTest)})},
  6618. args: [],
  6619. 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",
  6620. messageSends: ["new", "deny:", "==", "assert:", "yourself"],
  6621. referencedClasses: ["Object"]
  6622. }),
  6623. smalltalk.ObjectTest);
  6624. smalltalk.addMethod(
  6625. smalltalk.method({
  6626. selector: "testIfNil",
  6627. protocol: 'tests',
  6628. fn: function (){
  6629. var self=this;
  6630. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  6631. return smalltalk.withContext(function($ctx1) {
  6632. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10;
  6633. $2=_st($Object())._new();
  6634. $ctx1.sendIdx["new"]=1;
  6635. $1=_st($2)._isNil();
  6636. self._deny_($1);
  6637. $ctx1.sendIdx["deny:"]=1;
  6638. $5=_st($Object())._new();
  6639. $ctx1.sendIdx["new"]=2;
  6640. if(($receiver = $5) == nil || $receiver == null){
  6641. $4=true;
  6642. } else {
  6643. $4=$5;
  6644. };
  6645. $3=_st($4).__eq(true);
  6646. self._deny_($3);
  6647. $7=_st($Object())._new();
  6648. $ctx1.sendIdx["new"]=3;
  6649. if(($receiver = $7) == nil || $receiver == null){
  6650. $6=$7;
  6651. } else {
  6652. $6=true;
  6653. };
  6654. self._assert_equals_($6,true);
  6655. $ctx1.sendIdx["assert:equals:"]=1;
  6656. $9=_st($Object())._new();
  6657. $ctx1.sendIdx["new"]=4;
  6658. if(($receiver = $9) == nil || $receiver == null){
  6659. $8=false;
  6660. } else {
  6661. $8=true;
  6662. };
  6663. self._assert_equals_($8,true);
  6664. $ctx1.sendIdx["assert:equals:"]=2;
  6665. $11=_st($Object())._new();
  6666. if(($receiver = $11) == nil || $receiver == null){
  6667. $10=false;
  6668. } else {
  6669. $10=true;
  6670. };
  6671. self._assert_equals_($10,true);
  6672. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.ObjectTest)})},
  6673. args: [],
  6674. 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",
  6675. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  6676. referencedClasses: ["Object"]
  6677. }),
  6678. smalltalk.ObjectTest);
  6679. smalltalk.addMethod(
  6680. smalltalk.method({
  6681. selector: "testInstVars",
  6682. protocol: 'tests',
  6683. fn: function (){
  6684. var self=this;
  6685. var o;
  6686. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  6687. return smalltalk.withContext(function($ctx1) {
  6688. var $1,$2;
  6689. o=_st($ObjectMock())._new();
  6690. $1=_st(o)._instVarAt_("foo");
  6691. $ctx1.sendIdx["instVarAt:"]=1;
  6692. self._assert_equals_($1,nil);
  6693. $ctx1.sendIdx["assert:equals:"]=1;
  6694. _st(o)._instVarAt_put_("foo",(1));
  6695. $2=_st(o)._instVarAt_("foo");
  6696. $ctx1.sendIdx["instVarAt:"]=2;
  6697. self._assert_equals_($2,(1));
  6698. $ctx1.sendIdx["assert:equals:"]=2;
  6699. self._assert_equals_(_st(o)._instVarAt_("foo"),(1));
  6700. return self}, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},smalltalk.ObjectTest)})},
  6701. args: [],
  6702. 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",
  6703. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"],
  6704. referencedClasses: ["ObjectMock"]
  6705. }),
  6706. smalltalk.ObjectTest);
  6707. smalltalk.addMethod(
  6708. smalltalk.method({
  6709. selector: "testNilUndefined",
  6710. protocol: 'tests',
  6711. fn: function (){
  6712. var self=this;
  6713. return smalltalk.withContext(function($ctx1) {
  6714. self._assert_equals_(self._notDefined(),nil);
  6715. return self}, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},smalltalk.ObjectTest)})},
  6716. args: [],
  6717. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  6718. messageSends: ["assert:equals:", "notDefined"],
  6719. referencedClasses: []
  6720. }),
  6721. smalltalk.ObjectTest);
  6722. smalltalk.addMethod(
  6723. smalltalk.method({
  6724. selector: "testYourself",
  6725. protocol: 'tests',
  6726. fn: function (){
  6727. var self=this;
  6728. var o;
  6729. function $ObjectMock(){return smalltalk.ObjectMock||(typeof ObjectMock=="undefined"?nil:ObjectMock)}
  6730. return smalltalk.withContext(function($ctx1) {
  6731. o=_st($ObjectMock())._new();
  6732. self._assert_(_st(_st(o)._yourself()).__eq_eq(o));
  6733. return self}, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},smalltalk.ObjectTest)})},
  6734. args: [],
  6735. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  6736. messageSends: ["new", "assert:", "==", "yourself"],
  6737. referencedClasses: ["ObjectMock"]
  6738. }),
  6739. smalltalk.ObjectTest);
  6740. smalltalk.addMethod(
  6741. smalltalk.method({
  6742. selector: "testidentityHash",
  6743. protocol: 'tests',
  6744. fn: function (){
  6745. var self=this;
  6746. var o1,o2;
  6747. function $Object(){return smalltalk.Object||(typeof Object=="undefined"?nil:Object)}
  6748. return smalltalk.withContext(function($ctx1) {
  6749. var $2,$3,$1,$5,$4;
  6750. o1=_st($Object())._new();
  6751. $ctx1.sendIdx["new"]=1;
  6752. o2=_st($Object())._new();
  6753. $2=_st(o1)._identityHash();
  6754. $ctx1.sendIdx["identityHash"]=1;
  6755. $3=_st(o1)._identityHash();
  6756. $ctx1.sendIdx["identityHash"]=2;
  6757. $1=_st($2).__eq_eq($3);
  6758. $ctx1.sendIdx["=="]=1;
  6759. self._assert_($1);
  6760. $5=_st(o1)._identityHash();
  6761. $ctx1.sendIdx["identityHash"]=3;
  6762. $4=_st($5).__eq_eq(_st(o2)._identityHash());
  6763. self._deny_($4);
  6764. return self}, function($ctx1) {$ctx1.fill(self,"testidentityHash",{o1:o1,o2:o2},smalltalk.ObjectTest)})},
  6765. args: [],
  6766. 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",
  6767. messageSends: ["new", "assert:", "==", "identityHash", "deny:"],
  6768. referencedClasses: ["Object"]
  6769. }),
  6770. smalltalk.ObjectTest);
  6771. smalltalk.addClass('PointTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6772. smalltalk.addMethod(
  6773. smalltalk.method({
  6774. selector: "testAccessing",
  6775. protocol: 'tests',
  6776. fn: function (){
  6777. var self=this;
  6778. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  6779. return smalltalk.withContext(function($ctx1) {
  6780. var $2,$1,$3,$6,$5,$4;
  6781. $2=_st($Point())._x_y_((3),(4));
  6782. $ctx1.sendIdx["x:y:"]=1;
  6783. $1=_st($2)._x();
  6784. $ctx1.sendIdx["x"]=1;
  6785. self._assert_equals_($1,(3));
  6786. $ctx1.sendIdx["assert:equals:"]=1;
  6787. $3=_st(_st($Point())._x_y_((3),(4)))._y();
  6788. $ctx1.sendIdx["y"]=1;
  6789. self._assert_equals_($3,(4));
  6790. $ctx1.sendIdx["assert:equals:"]=2;
  6791. $6=_st($Point())._new();
  6792. $ctx1.sendIdx["new"]=1;
  6793. $5=_st($6)._x_((3));
  6794. $4=_st($5)._x();
  6795. self._assert_equals_($4,(3));
  6796. $ctx1.sendIdx["assert:equals:"]=3;
  6797. self._assert_equals_(_st(_st(_st($Point())._new())._y_((4)))._y(),(4));
  6798. return self}, function($ctx1) {$ctx1.fill(self,"testAccessing",{},smalltalk.PointTest)})},
  6799. args: [],
  6800. 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",
  6801. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"],
  6802. referencedClasses: ["Point"]
  6803. }),
  6804. smalltalk.PointTest);
  6805. smalltalk.addMethod(
  6806. smalltalk.method({
  6807. selector: "testArithmetic",
  6808. protocol: 'tests',
  6809. fn: function (){
  6810. var self=this;
  6811. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  6812. return smalltalk.withContext(function($ctx1) {
  6813. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  6814. $2=(3).__at((4));
  6815. $ctx1.sendIdx["@"]=1;
  6816. $3=(3).__at((4));
  6817. $ctx1.sendIdx["@"]=2;
  6818. $1=_st($2).__star($3);
  6819. $4=_st($Point())._x_y_((9),(16));
  6820. $ctx1.sendIdx["x:y:"]=1;
  6821. self._assert_equals_($1,$4);
  6822. $ctx1.sendIdx["assert:equals:"]=1;
  6823. $6=(3).__at((4));
  6824. $ctx1.sendIdx["@"]=3;
  6825. $7=(3).__at((4));
  6826. $ctx1.sendIdx["@"]=4;
  6827. $5=_st($6).__plus($7);
  6828. $8=_st($Point())._x_y_((6),(8));
  6829. $ctx1.sendIdx["x:y:"]=2;
  6830. self._assert_equals_($5,$8);
  6831. $ctx1.sendIdx["assert:equals:"]=2;
  6832. $10=(3).__at((4));
  6833. $ctx1.sendIdx["@"]=5;
  6834. $11=(3).__at((4));
  6835. $ctx1.sendIdx["@"]=6;
  6836. $9=_st($10).__minus($11);
  6837. $12=_st($Point())._x_y_((0),(0));
  6838. $ctx1.sendIdx["x:y:"]=3;
  6839. self._assert_equals_($9,$12);
  6840. $ctx1.sendIdx["assert:equals:"]=3;
  6841. $14=(6).__at((8));
  6842. $ctx1.sendIdx["@"]=7;
  6843. $13=_st($14).__slash((3).__at((4)));
  6844. self._assert_equals_($13,_st($Point())._x_y_((2),(2)));
  6845. return self}, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},smalltalk.PointTest)})},
  6846. args: [],
  6847. 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)",
  6848. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"],
  6849. referencedClasses: ["Point"]
  6850. }),
  6851. smalltalk.PointTest);
  6852. smalltalk.addMethod(
  6853. smalltalk.method({
  6854. selector: "testAt",
  6855. protocol: 'tests',
  6856. fn: function (){
  6857. var self=this;
  6858. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  6859. return smalltalk.withContext(function($ctx1) {
  6860. self._assert_equals_((3).__at((4)),_st($Point())._x_y_((3),(4)));
  6861. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.PointTest)})},
  6862. args: [],
  6863. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  6864. messageSends: ["assert:equals:", "@", "x:y:"],
  6865. referencedClasses: ["Point"]
  6866. }),
  6867. smalltalk.PointTest);
  6868. smalltalk.addMethod(
  6869. smalltalk.method({
  6870. selector: "testEgality",
  6871. protocol: 'tests',
  6872. fn: function (){
  6873. var self=this;
  6874. return smalltalk.withContext(function($ctx1) {
  6875. var $2,$3,$1,$5,$4;
  6876. $2=(3).__at((4));
  6877. $ctx1.sendIdx["@"]=1;
  6878. $3=(3).__at((4));
  6879. $ctx1.sendIdx["@"]=2;
  6880. $1=_st($2).__eq($3);
  6881. $ctx1.sendIdx["="]=1;
  6882. self._assert_($1);
  6883. $5=(3).__at((5));
  6884. $ctx1.sendIdx["@"]=3;
  6885. $4=_st($5).__eq((3).__at((6)));
  6886. self._deny_($4);
  6887. return self}, function($ctx1) {$ctx1.fill(self,"testEgality",{},smalltalk.PointTest)})},
  6888. args: [],
  6889. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  6890. messageSends: ["assert:", "=", "@", "deny:"],
  6891. referencedClasses: []
  6892. }),
  6893. smalltalk.PointTest);
  6894. smalltalk.addMethod(
  6895. smalltalk.method({
  6896. selector: "testNew",
  6897. protocol: 'tests',
  6898. fn: function (){
  6899. var self=this;
  6900. function $Point(){return smalltalk.Point||(typeof Point=="undefined"?nil:Point)}
  6901. return smalltalk.withContext(function($ctx1) {
  6902. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  6903. $3=_st($Point())._new();
  6904. $ctx1.sendIdx["new"]=1;
  6905. $2=_st($3)._x_((3));
  6906. $ctx1.sendIdx["x:"]=1;
  6907. $1=_st($2)._y();
  6908. $ctx1.sendIdx["y"]=1;
  6909. self._assert_equals_($1,nil);
  6910. $ctx1.sendIdx["assert:equals:"]=1;
  6911. $7=_st($Point())._new();
  6912. $ctx1.sendIdx["new"]=2;
  6913. $6=_st($7)._x_((3));
  6914. $5=_st($6)._x();
  6915. $ctx1.sendIdx["x"]=1;
  6916. $4=_st($5).__eq((0));
  6917. $ctx1.sendIdx["="]=1;
  6918. self._deny_($4);
  6919. $ctx1.sendIdx["deny:"]=1;
  6920. $10=_st($Point())._new();
  6921. $ctx1.sendIdx["new"]=3;
  6922. $9=_st($10)._y_((4));
  6923. $ctx1.sendIdx["y:"]=1;
  6924. $8=_st($9)._x();
  6925. self._assert_equals_($8,nil);
  6926. self._deny_(_st(_st(_st(_st($Point())._new())._y_((4)))._y()).__eq((0)));
  6927. return self}, function($ctx1) {$ctx1.fill(self,"testNew",{},smalltalk.PointTest)})},
  6928. args: [],
  6929. 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",
  6930. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"],
  6931. referencedClasses: ["Point"]
  6932. }),
  6933. smalltalk.PointTest);
  6934. smalltalk.addMethod(
  6935. smalltalk.method({
  6936. selector: "testTranslateBy",
  6937. protocol: 'tests',
  6938. fn: function (){
  6939. var self=this;
  6940. return smalltalk.withContext(function($ctx1) {
  6941. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  6942. $2=(3).__at((3));
  6943. $ctx1.sendIdx["@"]=1;
  6944. $3=(0).__at((1));
  6945. $ctx1.sendIdx["@"]=2;
  6946. $1=_st($2)._translateBy_($3);
  6947. $ctx1.sendIdx["translateBy:"]=1;
  6948. $4=(3).__at((4));
  6949. $ctx1.sendIdx["@"]=3;
  6950. self._assert_equals_($1,$4);
  6951. $ctx1.sendIdx["assert:equals:"]=1;
  6952. $6=(3).__at((3));
  6953. $ctx1.sendIdx["@"]=4;
  6954. $8=(1)._negated();
  6955. $ctx1.sendIdx["negated"]=1;
  6956. $7=(0).__at($8);
  6957. $ctx1.sendIdx["@"]=5;
  6958. $5=_st($6)._translateBy_($7);
  6959. $ctx1.sendIdx["translateBy:"]=2;
  6960. $9=(3).__at((2));
  6961. $ctx1.sendIdx["@"]=6;
  6962. self._assert_equals_($5,$9);
  6963. $ctx1.sendIdx["assert:equals:"]=2;
  6964. $11=(3).__at((3));
  6965. $ctx1.sendIdx["@"]=7;
  6966. $12=(2).__at((3));
  6967. $ctx1.sendIdx["@"]=8;
  6968. $10=_st($11)._translateBy_($12);
  6969. $ctx1.sendIdx["translateBy:"]=3;
  6970. $13=(5).__at((6));
  6971. $ctx1.sendIdx["@"]=9;
  6972. self._assert_equals_($10,$13);
  6973. $ctx1.sendIdx["assert:equals:"]=3;
  6974. $15=(3).__at((3));
  6975. $ctx1.sendIdx["@"]=10;
  6976. $16=_st((3)._negated()).__at((0));
  6977. $ctx1.sendIdx["@"]=11;
  6978. $14=_st($15)._translateBy_($16);
  6979. self._assert_equals_($14,(0).__at((3)));
  6980. return self}, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},smalltalk.PointTest)})},
  6981. args: [],
  6982. 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.",
  6983. messageSends: ["assert:equals:", "translateBy:", "@", "negated"],
  6984. referencedClasses: []
  6985. }),
  6986. smalltalk.PointTest);
  6987. smalltalk.addClass('QueueTest', smalltalk.TestCase, [], 'Kernel-Tests');
  6988. smalltalk.addMethod(
  6989. smalltalk.method({
  6990. selector: "testNextIfAbsent",
  6991. protocol: 'tests',
  6992. fn: function (){
  6993. var self=this;
  6994. var queue;
  6995. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  6996. return smalltalk.withContext(function($ctx1) {
  6997. var $2,$1;
  6998. queue=_st($Queue())._new();
  6999. _st(queue)._nextPut_("index1");
  7000. $2=_st(queue)._nextIfAbsent_("empty");
  7001. $ctx1.sendIdx["nextIfAbsent:"]=1;
  7002. $1=_st($2).__eq("index1");
  7003. $ctx1.sendIdx["="]=1;
  7004. self._assert_($1);
  7005. self._deny_(_st(_st(queue)._nextIfAbsent_("empty")).__eq("index1"));
  7006. return self}, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},smalltalk.QueueTest)})},
  7007. args: [],
  7008. 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'",
  7009. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"],
  7010. referencedClasses: ["Queue"]
  7011. }),
  7012. smalltalk.QueueTest);
  7013. smalltalk.addMethod(
  7014. smalltalk.method({
  7015. selector: "testQueueNext",
  7016. protocol: 'tests',
  7017. fn: function (){
  7018. var self=this;
  7019. var queue;
  7020. function $Queue(){return smalltalk.Queue||(typeof Queue=="undefined"?nil:Queue)}
  7021. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  7022. return smalltalk.withContext(function($ctx1) {
  7023. var $1,$2,$4,$3,$6,$5;
  7024. queue=_st($Queue())._new();
  7025. $1=queue;
  7026. _st($1)._nextPut_("index1");
  7027. $ctx1.sendIdx["nextPut:"]=1;
  7028. $2=_st($1)._nextPut_("index2");
  7029. $4=_st(queue)._next();
  7030. $ctx1.sendIdx["next"]=1;
  7031. $3=_st($4).__eq("index1");
  7032. $ctx1.sendIdx["="]=1;
  7033. self._assert_($3);
  7034. $6=_st(queue)._next();
  7035. $ctx1.sendIdx["next"]=2;
  7036. $5=_st($6).__eq("index");
  7037. self._deny_($5);
  7038. self._should_raise_((function(){
  7039. return smalltalk.withContext(function($ctx2) {
  7040. return _st(queue)._next();
  7041. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7042. return self}, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},smalltalk.QueueTest)})},
  7043. args: [],
  7044. 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",
  7045. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"],
  7046. referencedClasses: ["Queue", "Error"]
  7047. }),
  7048. smalltalk.QueueTest);
  7049. smalltalk.addClass('RandomTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7050. smalltalk.addMethod(
  7051. smalltalk.method({
  7052. selector: "testAtRandomNumber",
  7053. protocol: 'tests',
  7054. fn: function (){
  7055. var self=this;
  7056. var val;
  7057. return smalltalk.withContext(function($ctx1) {
  7058. (100)._timesRepeat_((function(){
  7059. return smalltalk.withContext(function($ctx2) {
  7060. val=(10)._atRandom();
  7061. val;
  7062. self._assert_(_st(val).__gt((0)));
  7063. $ctx2.sendIdx["assert:"]=1;
  7064. return self._assert_(_st(val).__lt((11)));
  7065. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7066. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},smalltalk.RandomTest)})},
  7067. args: [],
  7068. 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]",
  7069. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"],
  7070. referencedClasses: []
  7071. }),
  7072. smalltalk.RandomTest);
  7073. smalltalk.addMethod(
  7074. smalltalk.method({
  7075. selector: "testAtRandomSequenceableCollection",
  7076. protocol: 'tests',
  7077. fn: function (){
  7078. var self=this;
  7079. var val;
  7080. return smalltalk.withContext(function($ctx1) {
  7081. var $3,$4,$2,$1;
  7082. (100)._timesRepeat_((function(){
  7083. return smalltalk.withContext(function($ctx2) {
  7084. val="abc"._atRandom();
  7085. val;
  7086. $3=_st(val).__eq("a");
  7087. $ctx2.sendIdx["="]=1;
  7088. $4=_st(val).__eq("b");
  7089. $ctx2.sendIdx["="]=2;
  7090. $2=_st($3).__or($4);
  7091. $1=_st($2).__or(_st(val).__eq("c"));
  7092. $ctx2.sendIdx["|"]=1;
  7093. return self._assert_($1);
  7094. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  7095. return self}, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},smalltalk.RandomTest)})},
  7096. args: [],
  7097. 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].",
  7098. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="],
  7099. referencedClasses: []
  7100. }),
  7101. smalltalk.RandomTest);
  7102. smalltalk.addMethod(
  7103. smalltalk.method({
  7104. selector: "textNext",
  7105. protocol: 'tests',
  7106. fn: function (){
  7107. var self=this;
  7108. function $Random(){return smalltalk.Random||(typeof Random=="undefined"?nil:Random)}
  7109. return smalltalk.withContext(function($ctx1) {
  7110. var $1;
  7111. (10000)._timesRepeat_((function(){
  7112. var current,next;
  7113. return smalltalk.withContext(function($ctx2) {
  7114. next=_st(_st($Random())._new())._next();
  7115. next;
  7116. self._assert_(_st(next).__gt_eq((0)));
  7117. $ctx2.sendIdx["assert:"]=1;
  7118. self._assert_(_st(next).__lt((1)));
  7119. $1=_st(current).__eq(next);
  7120. $ctx2.sendIdx["="]=1;
  7121. self._deny_($1);
  7122. return _st(next).__eq(current);
  7123. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)})}));
  7124. return self}, function($ctx1) {$ctx1.fill(self,"textNext",{},smalltalk.RandomTest)})},
  7125. args: [],
  7126. 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 ]",
  7127. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="],
  7128. referencedClasses: ["Random"]
  7129. }),
  7130. smalltalk.RandomTest);
  7131. smalltalk.addClass('SetTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7132. smalltalk.addMethod(
  7133. smalltalk.method({
  7134. selector: "testAddRemove",
  7135. protocol: 'tests',
  7136. fn: function (){
  7137. var self=this;
  7138. var set;
  7139. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  7140. return smalltalk.withContext(function($ctx1) {
  7141. var $1,$2;
  7142. set=_st($Set())._new();
  7143. self._assert_(_st(set)._isEmpty());
  7144. $ctx1.sendIdx["assert:"]=1;
  7145. _st(set)._add_((3));
  7146. $ctx1.sendIdx["add:"]=1;
  7147. $1=_st(set)._includes_((3));
  7148. $ctx1.sendIdx["includes:"]=1;
  7149. self._assert_($1);
  7150. $ctx1.sendIdx["assert:"]=2;
  7151. _st(set)._add_((5));
  7152. $2=_st(set)._includes_((5));
  7153. $ctx1.sendIdx["includes:"]=2;
  7154. self._assert_($2);
  7155. _st(set)._remove_((3));
  7156. self._deny_(_st(set)._includes_((3)));
  7157. return self}, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},smalltalk.SetTest)})},
  7158. args: [],
  7159. 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)",
  7160. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"],
  7161. referencedClasses: ["Set"]
  7162. }),
  7163. smalltalk.SetTest);
  7164. smalltalk.addMethod(
  7165. smalltalk.method({
  7166. selector: "testAt",
  7167. protocol: 'tests',
  7168. fn: function (){
  7169. var self=this;
  7170. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  7171. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  7172. return smalltalk.withContext(function($ctx1) {
  7173. self._should_raise_((function(){
  7174. return smalltalk.withContext(function($ctx2) {
  7175. return _st(_st($Set())._new())._at_put_((1),(2));
  7176. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
  7177. return self}, function($ctx1) {$ctx1.fill(self,"testAt",{},smalltalk.SetTest)})},
  7178. args: [],
  7179. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  7180. messageSends: ["should:raise:", "at:put:", "new"],
  7181. referencedClasses: ["Set", "Error"]
  7182. }),
  7183. smalltalk.SetTest);
  7184. smalltalk.addMethod(
  7185. smalltalk.method({
  7186. selector: "testCollect",
  7187. protocol: 'tests',
  7188. fn: function (){
  7189. var self=this;
  7190. return smalltalk.withContext(function($ctx1) {
  7191. var $2,$1;
  7192. $2=[(5), (6), (8)]._asSet();
  7193. $ctx1.sendIdx["asSet"]=1;
  7194. $1=_st($2)._collect_((function(x){
  7195. return smalltalk.withContext(function($ctx2) {
  7196. return _st(x).__backslash_backslash((3));
  7197. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)})}));
  7198. self._assert_equals_($1,[(0), (2)]._asSet());
  7199. return self}, function($ctx1) {$ctx1.fill(self,"testCollect",{},smalltalk.SetTest)})},
  7200. args: [],
  7201. source: "testCollect\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  7202. messageSends: ["assert:equals:", "collect:", "asSet", "\x5c\x5c"],
  7203. referencedClasses: []
  7204. }),
  7205. smalltalk.SetTest);
  7206. smalltalk.addMethod(
  7207. smalltalk.method({
  7208. selector: "testComparing",
  7209. protocol: 'tests',
  7210. fn: function (){
  7211. var self=this;
  7212. return smalltalk.withContext(function($ctx1) {
  7213. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  7214. $1=[(0), (2)]._asSet();
  7215. $ctx1.sendIdx["asSet"]=1;
  7216. $2=[(0), (2)]._asSet();
  7217. $ctx1.sendIdx["asSet"]=2;
  7218. self._assert_equals_($1,$2);
  7219. $ctx1.sendIdx["assert:equals:"]=1;
  7220. $3=[(2), (0)]._asSet();
  7221. $ctx1.sendIdx["asSet"]=3;
  7222. $4=[(0), (2)]._asSet();
  7223. $ctx1.sendIdx["asSet"]=4;
  7224. self._assert_equals_($3,$4);
  7225. $6=[(0), (2), (3)]._asSet();
  7226. $ctx1.sendIdx["asSet"]=5;
  7227. $7=[(0), (2)]._asSet();
  7228. $ctx1.sendIdx["asSet"]=6;
  7229. $5=_st($6).__eq($7);
  7230. $ctx1.sendIdx["="]=1;
  7231. self._deny_($5);
  7232. $ctx1.sendIdx["deny:"]=1;
  7233. $9=[(1), (2)]._asSet();
  7234. $ctx1.sendIdx["asSet"]=7;
  7235. $8=_st($9).__eq([(0), (2)]._asSet());
  7236. self._deny_($8);
  7237. return self}, function($ctx1) {$ctx1.fill(self,"testComparing",{},smalltalk.SetTest)})},
  7238. args: [],
  7239. 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",
  7240. messageSends: ["assert:equals:", "asSet", "deny:", "="],
  7241. referencedClasses: []
  7242. }),
  7243. smalltalk.SetTest);
  7244. smalltalk.addMethod(
  7245. smalltalk.method({
  7246. selector: "testPrintString",
  7247. protocol: 'tests',
  7248. fn: function (){
  7249. var self=this;
  7250. var set;
  7251. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  7252. return smalltalk.withContext(function($ctx1) {
  7253. var $1,$2,$3,$4,$5,$6,$7,$8,$9;
  7254. set=_st($Set())._new();
  7255. $1=_st(set)._printString();
  7256. $ctx1.sendIdx["printString"]=1;
  7257. self._assert_equals_($1,"a Set ()");
  7258. $ctx1.sendIdx["assert:equals:"]=1;
  7259. $2=set;
  7260. _st($2)._add_((1));
  7261. $ctx1.sendIdx["add:"]=1;
  7262. $3=_st($2)._add_((3));
  7263. $ctx1.sendIdx["add:"]=2;
  7264. $4=_st(set)._printString();
  7265. $ctx1.sendIdx["printString"]=2;
  7266. self._assert_equals_($4,"a Set (1 3)");
  7267. $ctx1.sendIdx["assert:equals:"]=2;
  7268. _st(set)._add_("foo");
  7269. $ctx1.sendIdx["add:"]=3;
  7270. $5=_st(set)._printString();
  7271. $ctx1.sendIdx["printString"]=3;
  7272. self._assert_equals_($5,"a Set (1 3 'foo')");
  7273. $ctx1.sendIdx["assert:equals:"]=3;
  7274. $6=set;
  7275. _st($6)._remove_((1));
  7276. $ctx1.sendIdx["remove:"]=1;
  7277. $7=_st($6)._remove_((3));
  7278. $8=_st(set)._printString();
  7279. $ctx1.sendIdx["printString"]=4;
  7280. self._assert_equals_($8,"a Set ('foo')");
  7281. $ctx1.sendIdx["assert:equals:"]=4;
  7282. _st(set)._add_((3));
  7283. $ctx1.sendIdx["add:"]=4;
  7284. $9=_st(set)._printString();
  7285. $ctx1.sendIdx["printString"]=5;
  7286. self._assert_equals_($9,"a Set ('foo' 3)");
  7287. $ctx1.sendIdx["assert:equals:"]=5;
  7288. _st(set)._add_((3));
  7289. self._assert_equals_(_st(set)._printString(),"a Set ('foo' 3)");
  7290. return self}, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},smalltalk.SetTest)})},
  7291. args: [],
  7292. source: "testPrintString\x0a\x09| set |\x0a\x09set := Set new.\x0a\x09self assert: set printString equals: 'a Set ()'.\x0a\x09set add: 1; add: 3.\x0a\x09self assert: set printString equals: 'a Set (1 3)'.\x0a\x09set add: 'foo'.\x0a\x09self assert: set printString equals: 'a Set (1 3 ''foo'')'.\x0a\x09set remove: 1; remove: 3.\x0a\x09self assert: set printString equals: 'a Set (''foo'')'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (''foo'' 3)'.\x0a\x09set add: 3.\x0a\x09self assert: set printString equals: 'a Set (''foo'' 3)'",
  7293. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"],
  7294. referencedClasses: ["Set"]
  7295. }),
  7296. smalltalk.SetTest);
  7297. smalltalk.addMethod(
  7298. smalltalk.method({
  7299. selector: "testSize",
  7300. protocol: 'tests',
  7301. fn: function (){
  7302. var self=this;
  7303. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  7304. return smalltalk.withContext(function($ctx1) {
  7305. var $1,$3,$2;
  7306. $1=_st(_st($Set())._new())._size();
  7307. $ctx1.sendIdx["size"]=1;
  7308. self._assert_equals_($1,(0));
  7309. $ctx1.sendIdx["assert:equals:"]=1;
  7310. $3=_st($Set())._withAll_([(1), (2), (3), (4)]);
  7311. $ctx1.sendIdx["withAll:"]=1;
  7312. $2=_st($3)._size();
  7313. $ctx1.sendIdx["size"]=2;
  7314. self._assert_equals_($2,(4));
  7315. $ctx1.sendIdx["assert:equals:"]=2;
  7316. self._assert_equals_(_st(_st($Set())._withAll_([(1), (1), (1), (1)]))._size(),(1));
  7317. return self}, function($ctx1) {$ctx1.fill(self,"testSize",{},smalltalk.SetTest)})},
  7318. args: [],
  7319. source: "testSize\x0a\x09self assert: Set new size equals: 0.\x0a\x09self assert: (Set withAll: #(1 2 3 4)) size equals: 4.\x0a\x09self assert: (Set withAll: #(1 1 1 1)) size equals: 1",
  7320. messageSends: ["assert:equals:", "size", "new", "withAll:"],
  7321. referencedClasses: ["Set"]
  7322. }),
  7323. smalltalk.SetTest);
  7324. smalltalk.addMethod(
  7325. smalltalk.method({
  7326. selector: "testUnboxedObjects",
  7327. protocol: 'tests',
  7328. fn: function (){
  7329. var self=this;
  7330. return smalltalk.withContext(function($ctx1) {
  7331. var $4,$3,$2,$1;
  7332. $4="foo"._yourself();
  7333. $ctx1.sendIdx["yourself"]=1;
  7334. $3=[$4,"foo"._yourself()];
  7335. $2=_st($3)._asSet();
  7336. $1=_st($2)._asArray();
  7337. self._assert_equals_($1,["foo"]);
  7338. return self}, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},smalltalk.SetTest)})},
  7339. args: [],
  7340. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  7341. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"],
  7342. referencedClasses: []
  7343. }),
  7344. smalltalk.SetTest);
  7345. smalltalk.addMethod(
  7346. smalltalk.method({
  7347. selector: "testUnicity",
  7348. protocol: 'tests',
  7349. fn: function (){
  7350. var self=this;
  7351. var set;
  7352. function $Set(){return smalltalk.Set||(typeof Set=="undefined"?nil:Set)}
  7353. return smalltalk.withContext(function($ctx1) {
  7354. var $1;
  7355. set=_st($Set())._new();
  7356. _st(set)._add_((21));
  7357. $ctx1.sendIdx["add:"]=1;
  7358. _st(set)._add_("hello");
  7359. $ctx1.sendIdx["add:"]=2;
  7360. _st(set)._add_((21));
  7361. $ctx1.sendIdx["add:"]=3;
  7362. $1=_st(set)._size();
  7363. $ctx1.sendIdx["size"]=1;
  7364. self._assert_equals_($1,(2));
  7365. $ctx1.sendIdx["assert:equals:"]=1;
  7366. _st(set)._add_("hello");
  7367. self._assert_equals_(_st(set)._size(),(2));
  7368. $ctx1.sendIdx["assert:equals:"]=2;
  7369. self._assert_equals_(_st(set)._asArray(),[(21), "hello"]);
  7370. return self}, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},smalltalk.SetTest)})},
  7371. args: [],
  7372. 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')",
  7373. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"],
  7374. referencedClasses: ["Set"]
  7375. }),
  7376. smalltalk.SetTest);
  7377. smalltalk.addClass('StreamTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7378. smalltalk.addMethod(
  7379. smalltalk.method({
  7380. selector: "collectionClass",
  7381. protocol: 'accessing',
  7382. fn: function (){
  7383. var self=this;
  7384. return smalltalk.withContext(function($ctx1) {
  7385. var $1;
  7386. $1=_st(self._class())._collectionClass();
  7387. return $1;
  7388. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest)})},
  7389. args: [],
  7390. source: "collectionClass\x0a\x09^ self class collectionClass",
  7391. messageSends: ["collectionClass", "class"],
  7392. referencedClasses: []
  7393. }),
  7394. smalltalk.StreamTest);
  7395. smalltalk.addMethod(
  7396. smalltalk.method({
  7397. selector: "newCollection",
  7398. protocol: 'accessing',
  7399. fn: function (){
  7400. var self=this;
  7401. return smalltalk.withContext(function($ctx1) {
  7402. var $1;
  7403. $1=_st(self._collectionClass())._new();
  7404. return $1;
  7405. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StreamTest)})},
  7406. args: [],
  7407. source: "newCollection\x0a\x09^ self collectionClass new",
  7408. messageSends: ["new", "collectionClass"],
  7409. referencedClasses: []
  7410. }),
  7411. smalltalk.StreamTest);
  7412. smalltalk.addMethod(
  7413. smalltalk.method({
  7414. selector: "newStream",
  7415. protocol: 'accessing',
  7416. fn: function (){
  7417. var self=this;
  7418. return smalltalk.withContext(function($ctx1) {
  7419. var $1;
  7420. $1=_st(_st(self._collectionClass())._new())._stream();
  7421. return $1;
  7422. }, function($ctx1) {$ctx1.fill(self,"newStream",{},smalltalk.StreamTest)})},
  7423. args: [],
  7424. source: "newStream\x0a\x09^ self collectionClass new stream",
  7425. messageSends: ["stream", "new", "collectionClass"],
  7426. referencedClasses: []
  7427. }),
  7428. smalltalk.StreamTest);
  7429. smalltalk.addMethod(
  7430. smalltalk.method({
  7431. selector: "testAtStartAtEnd",
  7432. protocol: 'tests',
  7433. fn: function (){
  7434. var self=this;
  7435. var stream;
  7436. return smalltalk.withContext(function($ctx1) {
  7437. var $1,$2,$3,$4;
  7438. stream=self._newStream();
  7439. $1=_st(stream)._atStart();
  7440. $ctx1.sendIdx["atStart"]=1;
  7441. self._assert_($1);
  7442. $ctx1.sendIdx["assert:"]=1;
  7443. $2=_st(stream)._atEnd();
  7444. $ctx1.sendIdx["atEnd"]=1;
  7445. self._assert_($2);
  7446. $ctx1.sendIdx["assert:"]=2;
  7447. _st(stream)._nextPutAll_(self._newCollection());
  7448. $3=_st(stream)._atEnd();
  7449. $ctx1.sendIdx["atEnd"]=2;
  7450. self._assert_($3);
  7451. $4=_st(stream)._atStart();
  7452. $ctx1.sendIdx["atStart"]=2;
  7453. self._deny_($4);
  7454. $ctx1.sendIdx["deny:"]=1;
  7455. _st(stream)._position_((1));
  7456. self._deny_(_st(stream)._atEnd());
  7457. $ctx1.sendIdx["deny:"]=2;
  7458. self._deny_(_st(stream)._atStart());
  7459. return self}, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},smalltalk.StreamTest)})},
  7460. args: [],
  7461. 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",
  7462. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"],
  7463. referencedClasses: []
  7464. }),
  7465. smalltalk.StreamTest);
  7466. smalltalk.addMethod(
  7467. smalltalk.method({
  7468. selector: "testContents",
  7469. protocol: 'tests',
  7470. fn: function (){
  7471. var self=this;
  7472. var stream;
  7473. return smalltalk.withContext(function($ctx1) {
  7474. var $1,$2;
  7475. stream=self._newStream();
  7476. $1=stream;
  7477. $2=self._newCollection();
  7478. $ctx1.sendIdx["newCollection"]=1;
  7479. _st($1)._nextPutAll_($2);
  7480. self._assert_equals_(_st(stream)._contents(),self._newCollection());
  7481. return self}, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},smalltalk.StreamTest)})},
  7482. args: [],
  7483. 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",
  7484. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"],
  7485. referencedClasses: []
  7486. }),
  7487. smalltalk.StreamTest);
  7488. smalltalk.addMethod(
  7489. smalltalk.method({
  7490. selector: "testIsEmpty",
  7491. protocol: 'tests',
  7492. fn: function (){
  7493. var self=this;
  7494. var stream;
  7495. return smalltalk.withContext(function($ctx1) {
  7496. var $1;
  7497. stream=self._newStream();
  7498. $1=_st(stream)._isEmpty();
  7499. $ctx1.sendIdx["isEmpty"]=1;
  7500. self._assert_($1);
  7501. _st(stream)._nextPutAll_(self._newCollection());
  7502. self._deny_(_st(stream)._isEmpty());
  7503. return self}, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},smalltalk.StreamTest)})},
  7504. args: [],
  7505. 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",
  7506. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"],
  7507. referencedClasses: []
  7508. }),
  7509. smalltalk.StreamTest);
  7510. smalltalk.addMethod(
  7511. smalltalk.method({
  7512. selector: "testPosition",
  7513. protocol: 'tests',
  7514. fn: function (){
  7515. var self=this;
  7516. var collection,stream;
  7517. return smalltalk.withContext(function($ctx1) {
  7518. var $1,$2,$3;
  7519. collection=self._newCollection();
  7520. stream=self._newStream();
  7521. _st(stream)._nextPutAll_(collection);
  7522. $1=_st(stream)._position();
  7523. $ctx1.sendIdx["position"]=1;
  7524. self._assert_equals_($1,_st(collection)._size());
  7525. $ctx1.sendIdx["assert:equals:"]=1;
  7526. _st(stream)._position_((0));
  7527. $2=_st(stream)._position();
  7528. $ctx1.sendIdx["position"]=2;
  7529. self._assert_equals_($2,(0));
  7530. $ctx1.sendIdx["assert:equals:"]=2;
  7531. _st(stream)._next();
  7532. $ctx1.sendIdx["next"]=1;
  7533. $3=_st(stream)._position();
  7534. $ctx1.sendIdx["position"]=3;
  7535. self._assert_equals_($3,(1));
  7536. $ctx1.sendIdx["assert:equals:"]=3;
  7537. _st(stream)._next();
  7538. self._assert_equals_(_st(stream)._position(),(2));
  7539. return self}, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},smalltalk.StreamTest)})},
  7540. args: [],
  7541. 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",
  7542. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"],
  7543. referencedClasses: []
  7544. }),
  7545. smalltalk.StreamTest);
  7546. smalltalk.addMethod(
  7547. smalltalk.method({
  7548. selector: "testReading",
  7549. protocol: 'tests',
  7550. fn: function (){
  7551. var self=this;
  7552. var stream,collection;
  7553. return smalltalk.withContext(function($ctx1) {
  7554. var $1,$2,$3;
  7555. collection=self._newCollection();
  7556. stream=self._newStream();
  7557. $1=stream;
  7558. _st($1)._nextPutAll_(collection);
  7559. $2=_st($1)._position_((0));
  7560. _st(collection)._do_((function(each){
  7561. return smalltalk.withContext(function($ctx2) {
  7562. $3=_st(stream)._next();
  7563. $ctx2.sendIdx["next"]=1;
  7564. return self._assert_equals_($3,each);
  7565. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  7566. self._assert_(_st(_st(stream)._next())._isNil());
  7567. return self}, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  7568. args: [],
  7569. 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",
  7570. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"],
  7571. referencedClasses: []
  7572. }),
  7573. smalltalk.StreamTest);
  7574. smalltalk.addMethod(
  7575. smalltalk.method({
  7576. selector: "testStreamContents",
  7577. protocol: 'tests',
  7578. fn: function (){
  7579. var self=this;
  7580. return smalltalk.withContext(function($ctx1) {
  7581. return self}, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},smalltalk.StreamTest)})},
  7582. args: [],
  7583. source: "testStreamContents",
  7584. messageSends: [],
  7585. referencedClasses: []
  7586. }),
  7587. smalltalk.StreamTest);
  7588. smalltalk.addMethod(
  7589. smalltalk.method({
  7590. selector: "testWrite",
  7591. protocol: 'tests',
  7592. fn: function (){
  7593. var self=this;
  7594. var stream,collection;
  7595. return smalltalk.withContext(function($ctx1) {
  7596. collection=self._newCollection();
  7597. stream=self._newStream();
  7598. _st(collection)._do_((function(each){
  7599. return smalltalk.withContext(function($ctx2) {
  7600. return _st(stream).__lt_lt(each);
  7601. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  7602. self._assert_equals_(_st(stream)._contents(),collection);
  7603. return self}, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  7604. args: [],
  7605. 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",
  7606. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"],
  7607. referencedClasses: []
  7608. }),
  7609. smalltalk.StreamTest);
  7610. smalltalk.addMethod(
  7611. smalltalk.method({
  7612. selector: "testWriting",
  7613. protocol: 'tests',
  7614. fn: function (){
  7615. var self=this;
  7616. var stream,collection;
  7617. return smalltalk.withContext(function($ctx1) {
  7618. var $1;
  7619. collection=self._newCollection();
  7620. stream=self._newStream();
  7621. $ctx1.sendIdx["newStream"]=1;
  7622. _st(collection)._do_((function(each){
  7623. return smalltalk.withContext(function($ctx2) {
  7624. return _st(stream)._nextPut_(each);
  7625. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  7626. $1=_st(stream)._contents();
  7627. $ctx1.sendIdx["contents"]=1;
  7628. self._assert_equals_($1,collection);
  7629. $ctx1.sendIdx["assert:equals:"]=1;
  7630. stream=self._newStream();
  7631. _st(stream)._nextPutAll_(collection);
  7632. self._assert_equals_(_st(stream)._contents(),collection);
  7633. return self}, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},smalltalk.StreamTest)})},
  7634. args: [],
  7635. 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",
  7636. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"],
  7637. referencedClasses: []
  7638. }),
  7639. smalltalk.StreamTest);
  7640. smalltalk.addMethod(
  7641. smalltalk.method({
  7642. selector: "collectionClass",
  7643. protocol: 'accessing',
  7644. fn: function (){
  7645. var self=this;
  7646. return smalltalk.withContext(function($ctx1) {
  7647. return nil;
  7648. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StreamTest.klass)})},
  7649. args: [],
  7650. source: "collectionClass\x0a\x09^ nil",
  7651. messageSends: [],
  7652. referencedClasses: []
  7653. }),
  7654. smalltalk.StreamTest.klass);
  7655. smalltalk.addMethod(
  7656. smalltalk.method({
  7657. selector: "isAbstract",
  7658. protocol: 'testing',
  7659. fn: function (){
  7660. var self=this;
  7661. return smalltalk.withContext(function($ctx1) {
  7662. var $1;
  7663. $1=_st(self._collectionClass())._isNil();
  7664. return $1;
  7665. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},smalltalk.StreamTest.klass)})},
  7666. args: [],
  7667. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  7668. messageSends: ["isNil", "collectionClass"],
  7669. referencedClasses: []
  7670. }),
  7671. smalltalk.StreamTest.klass);
  7672. smalltalk.addClass('ArrayStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  7673. smalltalk.addMethod(
  7674. smalltalk.method({
  7675. selector: "newCollection",
  7676. protocol: 'accessing',
  7677. fn: function (){
  7678. var self=this;
  7679. return smalltalk.withContext(function($ctx1) {
  7680. var $1;
  7681. $1=[true,(1),(3).__at((4)),"foo"];
  7682. return $1;
  7683. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.ArrayStreamTest)})},
  7684. args: [],
  7685. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  7686. messageSends: ["@"],
  7687. referencedClasses: []
  7688. }),
  7689. smalltalk.ArrayStreamTest);
  7690. smalltalk.addMethod(
  7691. smalltalk.method({
  7692. selector: "collectionClass",
  7693. protocol: 'accessing',
  7694. fn: function (){
  7695. var self=this;
  7696. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  7697. return smalltalk.withContext(function($ctx1) {
  7698. return $Array();
  7699. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.ArrayStreamTest.klass)})},
  7700. args: [],
  7701. source: "collectionClass\x0a\x09^ Array",
  7702. messageSends: [],
  7703. referencedClasses: ["Array"]
  7704. }),
  7705. smalltalk.ArrayStreamTest.klass);
  7706. smalltalk.addClass('StringStreamTest', smalltalk.StreamTest, [], 'Kernel-Tests');
  7707. smalltalk.addMethod(
  7708. smalltalk.method({
  7709. selector: "newCollection",
  7710. protocol: 'accessing',
  7711. fn: function (){
  7712. var self=this;
  7713. return smalltalk.withContext(function($ctx1) {
  7714. return "hello world";
  7715. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},smalltalk.StringStreamTest)})},
  7716. args: [],
  7717. source: "newCollection\x0a\x09^ 'hello world'",
  7718. messageSends: [],
  7719. referencedClasses: []
  7720. }),
  7721. smalltalk.StringStreamTest);
  7722. smalltalk.addMethod(
  7723. smalltalk.method({
  7724. selector: "collectionClass",
  7725. protocol: 'accessing',
  7726. fn: function (){
  7727. var self=this;
  7728. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  7729. return smalltalk.withContext(function($ctx1) {
  7730. return $String();
  7731. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},smalltalk.StringStreamTest.klass)})},
  7732. args: [],
  7733. source: "collectionClass\x0a\x09^ String",
  7734. messageSends: [],
  7735. referencedClasses: ["String"]
  7736. }),
  7737. smalltalk.StringStreamTest.klass);
  7738. smalltalk.addClass('UndefinedTest', smalltalk.TestCase, [], 'Kernel-Tests');
  7739. smalltalk.addMethod(
  7740. smalltalk.method({
  7741. selector: "testCopying",
  7742. protocol: 'tests',
  7743. fn: function (){
  7744. var self=this;
  7745. return smalltalk.withContext(function($ctx1) {
  7746. self._assert_equals_(nil._copy(),nil);
  7747. return self}, function($ctx1) {$ctx1.fill(self,"testCopying",{},smalltalk.UndefinedTest)})},
  7748. args: [],
  7749. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  7750. messageSends: ["assert:equals:", "copy"],
  7751. referencedClasses: []
  7752. }),
  7753. smalltalk.UndefinedTest);
  7754. smalltalk.addMethod(
  7755. smalltalk.method({
  7756. selector: "testDeepCopy",
  7757. protocol: 'tests',
  7758. fn: function (){
  7759. var self=this;
  7760. return smalltalk.withContext(function($ctx1) {
  7761. self._assert_(_st(nil._deepCopy()).__eq(nil));
  7762. return self}, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},smalltalk.UndefinedTest)})},
  7763. args: [],
  7764. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  7765. messageSends: ["assert:", "=", "deepCopy"],
  7766. referencedClasses: []
  7767. }),
  7768. smalltalk.UndefinedTest);
  7769. smalltalk.addMethod(
  7770. smalltalk.method({
  7771. selector: "testIfNil",
  7772. protocol: 'tests',
  7773. fn: function (){
  7774. var self=this;
  7775. return smalltalk.withContext(function($ctx1) {
  7776. var $1,$3,$2,$4,$6,$5;
  7777. if(($receiver = nil) == nil || $receiver == null){
  7778. $1=true;
  7779. } else {
  7780. $1=nil;
  7781. };
  7782. self._assert_equals_($1,true);
  7783. $ctx1.sendIdx["assert:equals:"]=1;
  7784. if(($receiver = nil) == nil || $receiver == null){
  7785. $3=nil;
  7786. } else {
  7787. $3=true;
  7788. };
  7789. $2=_st($3).__eq(true);
  7790. $ctx1.sendIdx["="]=1;
  7791. self._deny_($2);
  7792. $ctx1.sendIdx["deny:"]=1;
  7793. if(($receiver = nil) == nil || $receiver == null){
  7794. $4=true;
  7795. } else {
  7796. $4=false;
  7797. };
  7798. self._assert_equals_($4,true);
  7799. if(($receiver = nil) == nil || $receiver == null){
  7800. $6=false;
  7801. } else {
  7802. $6=true;
  7803. };
  7804. $5=_st($6).__eq(true);
  7805. self._deny_($5);
  7806. return self}, function($ctx1) {$ctx1.fill(self,"testIfNil",{},smalltalk.UndefinedTest)})},
  7807. args: [],
  7808. 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",
  7809. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"],
  7810. referencedClasses: []
  7811. }),
  7812. smalltalk.UndefinedTest);
  7813. smalltalk.addMethod(
  7814. smalltalk.method({
  7815. selector: "testIsNil",
  7816. protocol: 'tests',
  7817. fn: function (){
  7818. var self=this;
  7819. return smalltalk.withContext(function($ctx1) {
  7820. self._assert_(nil._isNil());
  7821. self._deny_(nil._notNil());
  7822. return self}, function($ctx1) {$ctx1.fill(self,"testIsNil",{},smalltalk.UndefinedTest)})},
  7823. args: [],
  7824. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  7825. messageSends: ["assert:", "isNil", "deny:", "notNil"],
  7826. referencedClasses: []
  7827. }),
  7828. smalltalk.UndefinedTest);
  7829. });